Compare commits
No commits in common. "1ed1c09ed3c00e5357a2abf105f2412730c0bd59" and "36e412545ce3779c08a6fc522d7f775af44f15e2" have entirely different histories.
1ed1c09ed3
...
36e412545c
43 changed files with 1 additions and 454 deletions
|
|
@ -1 +0,0 @@
|
||||||
[{"kind":2,"language":"rest-book","value":"GET http://localhost:8000/api/quiz/","outputs":[{"mime":"x-application/rest-book","value":{"status":200,"statusText":"OK","headers":{"Allow":"GET, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:20:40 GMT","Content-Type":"application/json","Content-Length":"37","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"GET","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/","timeout":10000,"headers":{}},"data":{"quiz":"http://localhost/api/quiz/"}}},{"mime":"text/x-json","value":{"status":200,"statusText":"OK","headers":{"Allow":"GET, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:20:40 GMT","Content-Type":"application/json","Content-Length":"37","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/0.21.4"}},"request":{"method":"GET","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/","timeout":10000,"headers":{}},"data":{"quiz":"http://localhost/api/quiz/"}}},{"mime":"text/html","value":"[object Object]"}]},{"kind":2,"language":"rest-book","value":"POST http://localhost:8000/api/quiz/\r\nContent-Type: application/json\r\n\r\n{\r\n \"title\": \"Название\",\r\n \"description\": \"Описание\",\r\n \"author\": \"Автор\",\r\n \"time_limit\": 40,\r\n \"is_published\": false\r\n}","outputs":[{"mime":"x-application/rest-book","value":{"status":405,"statusText":"Method Not Allowed","headers":{"Allow":"GET, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:20:56 GMT","Content-Type":"application/json","Content-Length":"55","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","User-Agent":"axios/0.21.4","Content-Length":120}},"request":{"method":"POST","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/","timeout":10000,"headers":{"Content-Type":"application/json"},"data":{"title":"Название","description":"Описание","author":"Автор","time_limit":40,"is_published":false}},"data":{"detail":"Метод \"POST\" не разрешен."}}},{"mime":"text/x-json","value":{"status":405,"statusText":"Method Not Allowed","headers":{"Allow":"GET, HEAD, OPTIONS","Date":"Thu, 02 Apr 2026 11:20:56 GMT","Content-Type":"application/json","Content-Length":"55","Server":"nginx/1.29.7","X-Frame-Options":"DENY","Connection":"close"},"config":{"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json","User-Agent":"axios/0.21.4","Content-Length":120}},"request":{"method":"POST","httpVersion":"1.1","responseUrl":"http://localhost/api/quiz/","timeout":10000,"headers":{"Content-Type":"application/json"},"data":{"title":"Название","description":"Описание","author":"Автор","time_limit":40,"is_published":false}},"data":{"detail":"Метод \"POST\" не разрешен."}}},{"mime":"text/html","value":"[object Object]"}]},{"kind":2,"language":"rest-book","value":"GET http://localhost:8000/api/quiz/8/","outputs":[{"mime":"application/vnd.code.notebook.error","value":{"name":"Error","message":"{}"}}]},{"kind":2,"language":"rest-book","value":"PUT http://localhost:8000/api/quiz/8/\r\nContent-Type: application/json\r\n\r\n{\r\n \"title\": \"Новое Название\",\r\n \"description\": \"Новое Описание\",\r\n \"author\": \"Новый Автор\",\r\n \"time_limit\": 40,\r\n \"is_published\": true\r\n}","outputs":[{"mime":"application/vnd.code.notebook.error","value":{"name":"Error","message":"{}"}}]},{"kind":2,"language":"rest-book","value":"DELETE http://localhost:8000/api/quiz/8/","outputs":[{"mime":"application/vnd.code.notebook.error","value":{"name":"Error","message":"{}"}}]}]
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,11 +0,0 @@
|
||||||
FROM python:3.12-slim
|
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY requirements.txt .
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
"""
|
|
||||||
ASGI config for lab1 project.
|
|
||||||
|
|
||||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
|
||||||
|
|
||||||
For more information on this file, see
|
|
||||||
https://docs.djangoproject.com/en/6.0/howto/deployment/asgi/
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from django.core.asgi import get_asgi_application
|
|
||||||
|
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lab1.settings')
|
|
||||||
|
|
||||||
application = get_asgi_application()
|
|
||||||
|
|
@ -1,133 +0,0 @@
|
||||||
"""
|
|
||||||
Django settings for lab1 project.
|
|
||||||
|
|
||||||
Generated by 'django-admin startproject' using Django 6.0.3.
|
|
||||||
|
|
||||||
For more information on this file, see
|
|
||||||
https://docs.djangoproject.com/en/6.0/topics/settings/
|
|
||||||
|
|
||||||
For the full list of settings and their values, see
|
|
||||||
https://docs.djangoproject.com/en/6.0/ref/settings/
|
|
||||||
"""
|
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
||||||
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
|
||||||
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
|
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
|
||||||
SECRET_KEY = 'django-insecure--xqwhdo2$)n*y3yk=d*vmwx6nuwt8h=m5@_og_uzj+11^hu7))'
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['*']
|
|
||||||
CSRF_TRUSTED_ORIGINS = ['http://localhost']
|
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
|
||||||
'django.contrib.admin',
|
|
||||||
'django.contrib.auth',
|
|
||||||
'django.contrib.contenttypes',
|
|
||||||
'django.contrib.sessions',
|
|
||||||
'django.contrib.messages',
|
|
||||||
'django.contrib.staticfiles',
|
|
||||||
|
|
||||||
'rest_framework',
|
|
||||||
'quiz',
|
|
||||||
]
|
|
||||||
|
|
||||||
MIDDLEWARE = [
|
|
||||||
'django.middleware.security.SecurityMiddleware',
|
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
||||||
'django.middleware.common.CommonMiddleware',
|
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
||||||
]
|
|
||||||
|
|
||||||
ROOT_URLCONF = 'lab1.urls'
|
|
||||||
|
|
||||||
TEMPLATES = [
|
|
||||||
{
|
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
||||||
'DIRS': [],
|
|
||||||
'APP_DIRS': True,
|
|
||||||
'OPTIONS': {
|
|
||||||
'context_processors': [
|
|
||||||
'django.template.context_processors.request',
|
|
||||||
'django.contrib.auth.context_processors.auth',
|
|
||||||
'django.contrib.messages.context_processors.messages',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
WSGI_APPLICATION = 'lab1.wsgi.application'
|
|
||||||
|
|
||||||
|
|
||||||
# Database
|
|
||||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
|
||||||
'NAME': os.environ.get('POSTGRES_DB', 'lab_db'),
|
|
||||||
'USER': os.environ.get('POSTGRES_USER', 'django'),
|
|
||||||
'PASSWORD': os.environ.get('POSTGRES_PASSWORD', 'password'),
|
|
||||||
'HOST': os.environ.get('POSTGRES_HOST', 'postgres_service'),
|
|
||||||
'PORT': os.environ.get('POSTGRES_PORT', 5432),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
|
||||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators
|
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS = [
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
|
||||||
# https://docs.djangoproject.com/en/6.0/topics/i18n/
|
|
||||||
|
|
||||||
LANGUAGE_CODE = 'ru-ru'
|
|
||||||
|
|
||||||
TIME_ZONE = 'UTC'
|
|
||||||
|
|
||||||
USE_I18N = True
|
|
||||||
|
|
||||||
USE_TZ = True
|
|
||||||
|
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
|
||||||
# https://docs.djangoproject.com/en/6.0/howto/static-files/
|
|
||||||
|
|
||||||
STATIC_URL = 'static/'
|
|
||||||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
|
||||||
|
|
||||||
# Default primary key field type
|
|
||||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#default-auto-field
|
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
from django.contrib import admin
|
|
||||||
from django.urls import path, include
|
|
||||||
from rest_framework import routers
|
|
||||||
from quiz.views import QuizViewSet
|
|
||||||
|
|
||||||
router = routers.DefaultRouter()
|
|
||||||
router.register(r'quiz', QuizViewSet)
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
path('admin/', admin.site.urls),
|
|
||||||
path('api/', include(router.urls)),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
"""
|
|
||||||
WSGI config for lab1 project.
|
|
||||||
|
|
||||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
|
||||||
|
|
||||||
For more information on this file, see
|
|
||||||
https://docs.djangoproject.com/en/6.0/howto/deployment/wsgi/
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
|
||||||
|
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lab1.settings')
|
|
||||||
|
|
||||||
application = get_wsgi_application()
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
"""Django's command-line utility for administrative tasks."""
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Run administrative tasks."""
|
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lab1.settings')
|
|
||||||
try:
|
|
||||||
from django.core.management import execute_from_command_line
|
|
||||||
except ImportError as exc:
|
|
||||||
raise ImportError(
|
|
||||||
"Couldn't import Django. Are you sure it's installed and "
|
|
||||||
"available on your PYTHONPATH environment variable? Did you "
|
|
||||||
"forget to activate a virtual environment?"
|
|
||||||
) from exc
|
|
||||||
execute_from_command_line(sys.argv)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
from django.contrib import admin
|
|
||||||
from .models import Quiz
|
|
||||||
|
|
||||||
admin.site.register(Quiz)
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
from django.apps import AppConfig
|
|
||||||
|
|
||||||
|
|
||||||
class QuizConfig(AppConfig):
|
|
||||||
name = 'quiz'
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
import random
|
|
||||||
from .models import Quiz
|
|
||||||
from django.db import transaction
|
|
||||||
from faker import Faker
|
|
||||||
|
|
||||||
fk = Faker()
|
|
||||||
|
|
||||||
def gentestdata():
|
|
||||||
with transaction.atomic():
|
|
||||||
for i in range(100):
|
|
||||||
new_quiz = Quiz()
|
|
||||||
new_quiz.title = fk.sentence(nb_words=4)
|
|
||||||
new_quiz.description = fk.paragraph()
|
|
||||||
new_quiz.author = fk.name()
|
|
||||||
new_quiz.time_limit = random.randint(5, 60)
|
|
||||||
new_quiz.is_published = random.random() > 0.5
|
|
||||||
new_quiz.save()
|
|
||||||
print('Сделана генерация')
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
# Generated by Django 6.0.3 on 2026-03-05 08:16
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Quiz',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('title', models.CharField(max_length=200)),
|
|
||||||
('description', models.TextField()),
|
|
||||||
('author', models.CharField(max_length=100)),
|
|
||||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
||||||
('time_limit', models.IntegerField(help_text='Ограничение по времени в минутах')),
|
|
||||||
('is_published', models.BooleanField(default=False)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
from django.db import models
|
|
||||||
|
|
||||||
# Create your models here.
|
|
||||||
|
|
||||||
class Quiz(models.Model):
|
|
||||||
title = models.CharField(max_length=200)
|
|
||||||
description = models.TextField()
|
|
||||||
author = models.CharField(max_length=100)
|
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
|
||||||
time_limit = models.IntegerField(help_text='Ограничение по времени в минутах')
|
|
||||||
is_published = models.BooleanField(default=False)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.title
|
|
||||||
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
from rest_framework import serializers
|
|
||||||
from .models import Quiz
|
|
||||||
|
|
||||||
class QuizSerializer(serializers.ModelSerializer):
|
|
||||||
class Meta:
|
|
||||||
model = Quiz
|
|
||||||
fields = '__all__'
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
from django.shortcuts import render
|
|
||||||
|
|
||||||
from rest_framework import viewsets
|
|
||||||
from .models import Quiz
|
|
||||||
from .serializers import QuizSerializer
|
|
||||||
|
|
||||||
class QuizViewSet(viewsets.ModelViewSet):
|
|
||||||
queryset = Quiz.objects.all()
|
|
||||||
serializer_class = QuizSerializer
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
Django
|
|
||||||
djangorestframework
|
|
||||||
markdown
|
|
||||||
django-filter
|
|
||||||
django-cors-headers
|
|
||||||
psycopg[binary,pool]
|
|
||||||
faker
|
|
||||||
gunicorn
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
name: lab2-local
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres_service:
|
|
||||||
# https://hub.docker.com/_/postgres
|
|
||||||
image: postgres:alpine
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 30s
|
|
||||||
retries: 5
|
|
||||||
volumes:
|
|
||||||
- postgres_data:/var/lib/postgresql/data
|
|
||||||
|
|
||||||
backend_service:
|
|
||||||
build: ./backend
|
|
||||||
command: > # python manage.py createsuperuser --noinput &&
|
|
||||||
sh -c "python manage.py migrate &&
|
|
||||||
python manage.py shell -c 'from quiz.gentestdata import gentestdata; gentestdata()' &&
|
|
||||||
python manage.py collectstatic --no-input &&
|
|
||||||
gunicorn lab1.wsgi:application --bind 0.0.0.0:8000"
|
|
||||||
volumes:
|
|
||||||
- static_volume:/app/staticfiles
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
depends_on:
|
|
||||||
postgres_service:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
nginx_service:
|
|
||||||
build: ./nginx
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
volumes:
|
|
||||||
- static_volume:/staticfiles
|
|
||||||
depends_on:
|
|
||||||
- backend_service
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
static_volume:
|
|
||||||
postgres_data:
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
FROM nginx:latest
|
|
||||||
|
|
||||||
COPY templates /etc/nginx/templates/
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
|
|
||||||
resolver 127.0.0.11 valid=30s;
|
|
||||||
|
|
||||||
location /static/ {
|
|
||||||
alias /staticfiles/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /admin/ {
|
|
||||||
set $backend backend_service;
|
|
||||||
proxy_pass http://$backend:8000$request_uri;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_redirect off;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api/ {
|
|
||||||
set $backend backend_service;
|
|
||||||
proxy_pass http://$backend:8000$request_uri;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_redirect off;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
name: lab2-web-lite
|
|
||||||
|
|
||||||
services:
|
|
||||||
backend_service:
|
|
||||||
image: dcr.deev.su/deevev/lab2-backend:1.0.0
|
|
||||||
command: >
|
|
||||||
sh -c "python manage.py migrate &&
|
|
||||||
python manage.py collectstatic --no-input &&
|
|
||||||
gunicorn lab1.wsgi:application --bind 0.0.0.0:8000"
|
|
||||||
volumes:
|
|
||||||
- static_volume:/app/staticfiles
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
nginx_service:
|
|
||||||
image: dcr.deev.su/deevev/lab2-nginx:1.0.0
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
volumes:
|
|
||||||
- static_volume:/staticfiles
|
|
||||||
depends_on:
|
|
||||||
- backend_service
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
static_volume:
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
name: lab2-web-pg
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres_service:
|
|
||||||
image: postgres:alpine
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 30s
|
|
||||||
retries: 5
|
|
||||||
volumes:
|
|
||||||
- postgres_data:/var/lib/postgresql/data
|
|
||||||
|
|
||||||
backend_service:
|
|
||||||
image: dcr.deev.su/deevev/lab2-backend:1.0.0
|
|
||||||
command: > # python manage.py createsuperuser --noinput &&
|
|
||||||
sh -c "python manage.py migrate &&
|
|
||||||
python manage.py shell -c 'from quiz.gentestdata import gentestdata; gentestdata()' &&
|
|
||||||
python manage.py collectstatic --no-input &&
|
|
||||||
gunicorn lab1.wsgi:application --bind 0.0.0.0:8000"
|
|
||||||
volumes:
|
|
||||||
- static_volume:/app/staticfiles
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
depends_on:
|
|
||||||
postgres_service:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
nginx_service:
|
|
||||||
image: dcr.deev.su/deevev/lab2-nginx:1.0.0
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
volumes:
|
|
||||||
- static_volume:/staticfiles
|
|
||||||
depends_on:
|
|
||||||
- backend_service
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
static_volume:
|
|
||||||
postgres_data:
|
|
||||||
1
lab1/http.restbook
Normal file
1
lab1/http.restbook
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue