mirror of
https://github.com/aykhans/series-robot-web.git
synced 2025-04-21 06:13:34 +00:00
added gunicorn
This commit is contained in:
parent
e613fe1874
commit
46bbb10d20
@ -1,5 +1,4 @@
|
|||||||
FROM python:3
|
FROM python:3
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
COPY requirements.txt /code/
|
COPY requirements.txt /code/
|
||||||
|
19
config/nginx/local.conf
Normal file
19
config/nginx/local.conf
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
upstream restgunicorn_server{
|
||||||
|
server django:8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
server{
|
||||||
|
listen 8080;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://restgunicorn_server;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /django_static/ {
|
||||||
|
alias /src/django_static/;
|
||||||
|
}
|
||||||
|
}
|
@ -5,16 +5,28 @@ services:
|
|||||||
image: postgres
|
image: postgres
|
||||||
volumes:
|
volumes:
|
||||||
- dbdata:/var/lib/postgresql/data
|
- dbdata:/var/lib/postgresql/data
|
||||||
|
- static_volume:/src/django_static
|
||||||
env_file:
|
env_file:
|
||||||
- config/db/databasepostgresql_env
|
- config/db/databasepostgresql_env
|
||||||
|
|
||||||
django:
|
django:
|
||||||
build: .
|
build: .
|
||||||
command: python3 src/manage.py runserver 0.0.0.0:8000 --settings=config.settings.production
|
command: gunicorn src.config.wsgi:application --bind 0.0.0.0:8000
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx
|
||||||
|
ports:
|
||||||
|
- "1337:8080"
|
||||||
|
volumes:
|
||||||
|
- ./config/nginx/local.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
- static_volume:/src/django_static
|
||||||
|
depends_on:
|
||||||
|
- django
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
dbdata:
|
dbdata:
|
||||||
|
static_volume:
|
@ -31,3 +31,4 @@ urllib3==1.26.12
|
|||||||
vine==5.0.0
|
vine==5.0.0
|
||||||
wcwidth==0.2.5
|
wcwidth==0.2.5
|
||||||
wrapt==1.14.1
|
wrapt==1.14.1
|
||||||
|
gunicorn
|
@ -16,7 +16,10 @@ DATABASES = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/django_static/'
|
||||||
STATICFILES_DIRS = [
|
STATIC_ROOT = [
|
||||||
BASE_DIR / 'static'
|
BASE_DIR / 'django_static'
|
||||||
|
]
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
BASE_DIR / 'django_static/static'
|
||||||
]
|
]
|
@ -1,16 +1,7 @@
|
|||||||
"""
|
|
||||||
WSGI config for config 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/4.1/howto/deployment/wsgi/
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.production')
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user