Setup gunicorn for production WSGI server

This commit is contained in:
Jake Howard 2022-07-28 14:53:22 +01:00
parent 97d786e969
commit e2e0144b6a
Signed by: jake
GPG key ID: 57AFB45680EDD477
4 changed files with 14 additions and 1 deletions

View file

@ -36,6 +36,8 @@ COPY --chown=website ./website ./website
RUN SECRET_KEY=none python manage.py collectstatic --noinput --clear -v3 RUN SECRET_KEY=none python manage.py collectstatic --noinput --clear -v3
CMD gunicorn
# Just dev stuff # Just dev stuff
FROM production as dev FROM production as dev

10
gunicorn.conf.py Normal file
View file

@ -0,0 +1,10 @@
import gunicorn
wsgi_app = "website.wsgi:application"
accesslog = "-"
disable_redirect_access_to_syslog = True
preload_app = True
bind = "0.0.0.0"
# Replace gunicorn's 'Server' HTTP header
gunicorn.SERVER_SOFTWARE = "Wouldn't you like to know"

View file

@ -11,3 +11,4 @@ wagtail-generic-chooser==0.4.1
django-rq==2.5.1 django-rq==2.5.1
django-redis==5.2.0 django-redis==5.2.0
wagtail-draftail-snippet==0.4.1 wagtail-draftail-snippet==0.4.1
gunicorn==20.1.0

View file

@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings.dev") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings")
application = get_wsgi_application() application = get_wsgi_application()