├── .dockerignore ├── .env.sample ├── .gitignore ├── Dockerfile ├── README.md ├── app ├── app │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── core │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── wait_for_db.py │ ├── migrations │ │ ├── 0001_initial.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py └── manage.py ├── docker-compose-deploy.yml ├── docker-compose.yml ├── proxy ├── Dockerfile ├── default.conf.tpl ├── run.sh └── uwsgi_params ├── requirements.txt └── scripts └── run.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | # Git 2 | .git 3 | .gitignore 4 | 5 | # Docker 6 | .docker 7 | 8 | # Python 9 | app/__pycache__/ 10 | app/*/__pycache__/ 11 | app/*/*/__pycache__/ 12 | app/*/*/*/__pycache__/ 13 | .env/ 14 | .venv/ 15 | venv/ 16 | 17 | # Local PostgreSQL data 18 | data/ 19 | -------------------------------------------------------------------------------- /.env.sample: -------------------------------------------------------------------------------- 1 | DB_NAME=dbname 2 | DB_USER=rootuser 3 | DB_PASS=changeme 4 | SECRET_KEY=changeme 5 | ALLOWED_HOSTS=127.0.0.1 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | /data 132 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9-alpine3.13 2 | LABEL maintainer="londonappdeveloper.com" 3 | 4 | ENV PYTHONUNBUFFERED 1 5 | 6 | COPY ./requirements.txt /requirements.txt 7 | COPY ./app /app 8 | COPY ./scripts /scripts 9 | 10 | WORKDIR /app 11 | EXPOSE 8000 12 | 13 | RUN python -m venv /py && \ 14 | /py/bin/pip install --upgrade pip && \ 15 | apk add --update --no-cache postgresql-client && \ 16 | apk add --update --no-cache --virtual .tmp-deps \ 17 | build-base postgresql-dev musl-dev linux-headers && \ 18 | /py/bin/pip install -r /requirements.txt && \ 19 | apk del .tmp-deps && \ 20 | adduser --disabled-password --no-create-home app && \ 21 | mkdir -p /vol/web/static && \ 22 | mkdir -p /vol/web/media && \ 23 | chown -R app:app /vol && \ 24 | chmod -R 755 /vol && \ 25 | chmod -R +x /scripts 26 | 27 | ENV PATH="/scripts:/py/bin:$PATH" 28 | 29 | USER app 30 | 31 | CMD ["run.sh"] 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | Banner image 4 | 5 |
6 | 7 |
8 |

Full-Stack Consulting and Courses.

9 | Website | 10 | Courses | 11 | Tutorials | 12 | Consulting 13 |
14 | 15 |

16 | 17 | # Deploying Django with Docker Compose 18 | 19 | This is the finished source code for the tutorial [Deploying Django with Docker Compose](https://londonappdeveloper.com/deploying-django-with-docker-compose/). 20 | 21 | In this tutorial, we teach you how to prepare and deploying a Django project to an AWS EC2 instance using Docker Compose. 22 | -------------------------------------------------------------------------------- /app/app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LondonAppDeveloper/deploy-django-with-docker-compose/3b5991465758ef4693c1a3a1e1d6739fc9ae01d1/app/app/__init__.py -------------------------------------------------------------------------------- /app/app/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for app project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /app/app/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for app project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.2.3. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.2/ref/settings/ 11 | """ 12 | import os 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = os.environ.get('SECRET_KEY') 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = bool(int(os.environ.get('DEBUG', 0))) 27 | 28 | ALLOWED_HOSTS = [] 29 | ALLOWED_HOSTS.extend( 30 | filter( 31 | None, 32 | os.environ.get('ALLOWED_HOSTS', '').split(','), 33 | ) 34 | ) 35 | 36 | 37 | # Application definition 38 | 39 | INSTALLED_APPS = [ 40 | 'django.contrib.admin', 41 | 'django.contrib.auth', 42 | 'django.contrib.contenttypes', 43 | 'django.contrib.sessions', 44 | 'django.contrib.messages', 45 | 'django.contrib.staticfiles', 46 | 'core', 47 | ] 48 | 49 | MIDDLEWARE = [ 50 | 'django.middleware.security.SecurityMiddleware', 51 | 'django.contrib.sessions.middleware.SessionMiddleware', 52 | 'django.middleware.common.CommonMiddleware', 53 | 'django.middleware.csrf.CsrfViewMiddleware', 54 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 55 | 'django.contrib.messages.middleware.MessageMiddleware', 56 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 57 | ] 58 | 59 | ROOT_URLCONF = 'app.urls' 60 | 61 | TEMPLATES = [ 62 | { 63 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 64 | 'DIRS': [], 65 | 'APP_DIRS': True, 66 | 'OPTIONS': { 67 | 'context_processors': [ 68 | 'django.template.context_processors.debug', 69 | 'django.template.context_processors.request', 70 | 'django.contrib.auth.context_processors.auth', 71 | 'django.contrib.messages.context_processors.messages', 72 | ], 73 | }, 74 | }, 75 | ] 76 | 77 | WSGI_APPLICATION = 'app.wsgi.application' 78 | 79 | 80 | # Database 81 | # https://docs.djangoproject.com/en/3.2/ref/settings/#databases 82 | 83 | DATABASES = { 84 | 'default': { 85 | 'ENGINE': 'django.db.backends.postgresql', 86 | 'HOST': os.environ.get('DB_HOST'), 87 | 'NAME': os.environ.get('DB_NAME'), 88 | 'USER': os.environ.get('DB_USER'), 89 | 'PASSWORD': os.environ.get('DB_PASS'), 90 | } 91 | } 92 | 93 | 94 | # Password validation 95 | # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators 96 | 97 | AUTH_PASSWORD_VALIDATORS = [ 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 100 | }, 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 103 | }, 104 | { 105 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 106 | }, 107 | { 108 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 109 | }, 110 | ] 111 | 112 | 113 | # Internationalization 114 | # https://docs.djangoproject.com/en/3.2/topics/i18n/ 115 | 116 | LANGUAGE_CODE = 'en-us' 117 | 118 | TIME_ZONE = 'UTC' 119 | 120 | USE_I18N = True 121 | 122 | USE_L10N = True 123 | 124 | USE_TZ = True 125 | 126 | 127 | # Static files (CSS, JavaScript, Images) 128 | # https://docs.djangoproject.com/en/3.2/howto/static-files/ 129 | 130 | STATIC_URL = '/static/static/' 131 | MEDIA_URL = '/static/media/' 132 | 133 | MEDIA_ROOT = '/vol/web/media' 134 | STATIC_ROOT = '/vol/web/static' 135 | 136 | # Default primary key field type 137 | # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field 138 | 139 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 140 | -------------------------------------------------------------------------------- /app/app/urls.py: -------------------------------------------------------------------------------- 1 | """app URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from django.conf.urls.static import static 19 | from django.conf import settings 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | ] 24 | 25 | if settings.DEBUG: 26 | urlpatterns += static( 27 | settings.MEDIA_URL, 28 | document_root=settings.MEDIA_ROOT, 29 | ) 30 | -------------------------------------------------------------------------------- /app/app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for app project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /app/core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LondonAppDeveloper/deploy-django-with-docker-compose/3b5991465758ef4693c1a3a1e1d6739fc9ae01d1/app/core/__init__.py -------------------------------------------------------------------------------- /app/core/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from core.models import Sample 4 | 5 | 6 | admin.site.register(Sample) 7 | -------------------------------------------------------------------------------- /app/core/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CoreConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'core' 7 | -------------------------------------------------------------------------------- /app/core/management/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LondonAppDeveloper/deploy-django-with-docker-compose/3b5991465758ef4693c1a3a1e1d6739fc9ae01d1/app/core/management/__init__.py -------------------------------------------------------------------------------- /app/core/management/commands/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LondonAppDeveloper/deploy-django-with-docker-compose/3b5991465758ef4693c1a3a1e1d6739fc9ae01d1/app/core/management/commands/__init__.py -------------------------------------------------------------------------------- /app/core/management/commands/wait_for_db.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django command to wait for the database to be available. 3 | """ 4 | import time 5 | 6 | from psycopg2 import OperationalError as Psycopg2OpError 7 | 8 | from django.db.utils import OperationalError 9 | from django.core.management.base import BaseCommand 10 | 11 | 12 | class Command(BaseCommand): 13 | """Django command to wait for database.""" 14 | 15 | def handle(self, *args, **options): 16 | """Entrypoint for command.""" 17 | self.stdout.write('Waiting for database...') 18 | db_up = False 19 | while db_up is False: 20 | try: 21 | self.check(databases=['default']) 22 | db_up = True 23 | except (Psycopg2OpError, OperationalError): 24 | self.stdout.write('Database unavailable, waiting 1 second...') 25 | time.sleep(1) 26 | 27 | self.stdout.write(self.style.SUCCESS('Database available!')) 28 | -------------------------------------------------------------------------------- /app/core/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-17 20:01 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Sample', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('attachment', models.FileField(upload_to='')), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /app/core/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LondonAppDeveloper/deploy-django-with-docker-compose/3b5991465758ef4693c1a3a1e1d6739fc9ae01d1/app/core/migrations/__init__.py -------------------------------------------------------------------------------- /app/core/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Sample(models.Model): 5 | attachment = models.FileField() 6 | -------------------------------------------------------------------------------- /app/core/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /app/core/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /app/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /docker-compose-deploy.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | services: 4 | app: 5 | build: 6 | context: . 7 | restart: always 8 | volumes: 9 | - static-data:/vol/web 10 | environment: 11 | - DB_HOST=db 12 | - DB_NAME=${DB_NAME} 13 | - DB_USER=${DB_USER} 14 | - DB_PASS=${DB_PASS} 15 | - SECRET_KEY=${SECRET_KEY} 16 | - ALLOWED_HOSTS=${ALLOWED_HOSTS} 17 | depends_on: 18 | - db 19 | 20 | db: 21 | image: postgres:13-alpine 22 | restart: always 23 | volumes: 24 | - postgres-data:/var/lib/postgresql/data 25 | environment: 26 | - POSTGRES_DB=${DB_NAME} 27 | - POSTGRES_USER=${DB_USER} 28 | - POSTGRES_PASSWORD=${DB_PASS} 29 | 30 | proxy: 31 | build: 32 | context: ./proxy 33 | restart: always 34 | depends_on: 35 | - app 36 | ports: 37 | - 80:8000 38 | volumes: 39 | - static-data:/vol/static 40 | 41 | volumes: 42 | postgres-data: 43 | static-data: 44 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.9' 2 | 3 | services: 4 | app: 5 | build: 6 | context: . 7 | command: > 8 | sh -c "python manage.py wait_for_db && 9 | python manage.py migrate && 10 | python manage.py runserver 0.0.0.0:8000" 11 | ports: 12 | - 8000:8000 13 | volumes: 14 | - ./app:/app 15 | - ./data/web:/vol/web 16 | environment: 17 | - SECRET_KEY=devsecretkey 18 | - DEBUG=1 19 | - DB_HOST=db 20 | - DB_NAME=devdb 21 | - DB_USER=devuser 22 | - DB_PASS=changeme 23 | depends_on: 24 | - db 25 | 26 | db: 27 | image: postgres:13-alpine 28 | environment: 29 | - POSTGRES_DB=devdb 30 | - POSTGRES_USER=devuser 31 | - POSTGRES_PASSWORD=changeme 32 | -------------------------------------------------------------------------------- /proxy/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginxinc/nginx-unprivileged:1-alpine 2 | LABEL maintainer="londonappdeveloper.com" 3 | 4 | COPY ./default.conf.tpl /etc/nginx/default.conf.tpl 5 | COPY ./uwsgi_params /etc/nginx/uwsgi_params 6 | COPY ./run.sh /run.sh 7 | 8 | ENV LISTEN_PORT=8000 9 | ENV APP_HOST=app 10 | ENV APP_PORT=9000 11 | 12 | USER root 13 | 14 | RUN mkdir -p /vol/static && \ 15 | chmod 755 /vol/static && \ 16 | touch /etc/nginx/conf.d/default.conf && \ 17 | chown nginx:nginx /etc/nginx/conf.d/default.conf && \ 18 | chmod +x /run.sh 19 | 20 | VOLUME /vol/static 21 | 22 | USER nginx 23 | 24 | CMD ["/run.sh"] 25 | -------------------------------------------------------------------------------- /proxy/default.conf.tpl: -------------------------------------------------------------------------------- 1 | server { 2 | listen ${LISTEN_PORT}; 3 | 4 | location /static { 5 | alias /vol/static; 6 | } 7 | 8 | location / { 9 | uwsgi_pass ${APP_HOST}:${APP_PORT}; 10 | include /etc/nginx/uwsgi_params; 11 | client_max_body_size 10M; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /proxy/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | envsubst < /etc/nginx/default.conf.tpl > /etc/nginx/conf.d/default.conf 6 | nginx -g 'daemon off;' 7 | -------------------------------------------------------------------------------- /proxy/uwsgi_params: -------------------------------------------------------------------------------- 1 | uwsgi_param QUERY_STRING $query_string; 2 | uwsgi_param REQUEST_METHOD $request_method; 3 | uwsgi_param CONTENT_TYPE $content_type; 4 | uwsgi_param CONTENT_LENGTH $content_length; 5 | uwsgi_param REQUEST_URI $request_uri; 6 | uwsgi_param PATH_INFO $document_uri; 7 | uwsgi_param DOCUMENT_ROOT $document_root; 8 | uwsgi_param SERVER_PROTOCOL $server_protocol; 9 | uwsgi_param REMOTE_ADDR $remote_addr; 10 | uwsgi_param REMOTE_PORT $remote_port; 11 | uwsgi_param SERVER_ADDR $server_addr; 12 | uwsgi_param SERVER_PORT $server_port; 13 | uwsgi_param SERVER_NAME $server_name; 14 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django>=3.2.3,<3.3 2 | psycopg2>=2.8.6,<2.9 3 | uWSGI>=2.0.19.1,<2.1 4 | -------------------------------------------------------------------------------- /scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | ls -la /vol/ 6 | ls -la /vol/web 7 | 8 | whoami 9 | 10 | python manage.py wait_for_db 11 | python manage.py collectstatic --noinput 12 | python manage.py migrate 13 | 14 | uwsgi --socket :9000 --workers 4 --master --enable-threads --module app.wsgi 15 | --------------------------------------------------------------------------------