Updated Whitenoise configuration

This commit is contained in:
Oleg Lavrovsky 2018-11-12 18:54:25 +01:00
parent 43de7f5ced
commit bd584416e9
3 changed files with 9 additions and 8 deletions

View File

@ -73,6 +73,8 @@ INSTALLED_APPS = [
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@ -170,6 +172,10 @@ STATICFILES_DIRS = [
os.path.join(PROJECT_DIR, 'static'),
]
# Whitenoise compression and caching support
# http://whitenoise.evans.io/en/stable/django.html
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'

View File

@ -24,7 +24,9 @@ DATABASES = {
}
}
INSTALLED_APPS = INSTALLED_APPS + [
INSTALLED_APPS = [
'whitenoise.runserver_nostatic',
] + INSTALLED_APPS + [
'wagtail.contrib.wagtailstyleguide',
]

View File

@ -9,11 +9,4 @@ https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
import os
from whitenoise.django import DjangoWhiteNoise
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "publichealth.settings.production")
application = DjangoWhiteNoise(get_wsgi_application())