From 960e18a121225aa8e9681d57f4577d8b44ddf05b Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Mon, 22 Jan 2018 21:25:42 +0100 Subject: [PATCH] Re-enable whitenoise --- .gitignore | 2 ++ refunds/settings.py | 4 ++++ refunds/wsgi.py | 2 ++ requirements.txt | 1 + 4 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 1a8ba67..681ed94 100644 --- a/.gitignore +++ b/.gitignore @@ -135,3 +135,5 @@ fabric.properties # *.iml # modules.xml + +staticfiles diff --git a/refunds/settings.py b/refunds/settings.py index 1205d3d..85fec5e 100644 --- a/refunds/settings.py +++ b/refunds/settings.py @@ -155,6 +155,10 @@ STATICFILES_DIRS = ( 'static' ) +# Simplified static file serving. +# https://warehouse.python.org/project/whitenoise/ + +STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' LOGIN_URL = 'auth_login' LOGOUT_URL = 'auth_logout' diff --git a/refunds/wsgi.py b/refunds/wsgi.py index 1a5ba1a..adee6e5 100644 --- a/refunds/wsgi.py +++ b/refunds/wsgi.py @@ -10,7 +10,9 @@ https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ import os from django.core.wsgi import get_wsgi_application +from whitenoise.django import DjangoWhiteNoise os.environ.setdefault("DJANGO_SETTINGS_MODULE", "refunds.settings") application = get_wsgi_application() +application = DjangoWhiteNoise(application) diff --git a/requirements.txt b/requirements.txt index 9cc6963..04dfc95 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ django-dotenv==1.4.1 gunicorn==19.6.0 psycopg2==2.6.2 pytz +whitenoise==3.2.1