Updated Whitenoise configuration
This commit is contained in:
parent
43de7f5ced
commit
bd584416e9
3 changed files with 9 additions and 8 deletions
|
@ -73,6 +73,8 @@ INSTALLED_APPS = [
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = [
|
MIDDLEWARE_CLASSES = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||||
|
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
@ -170,6 +172,10 @@ STATICFILES_DIRS = [
|
||||||
os.path.join(PROJECT_DIR, 'static'),
|
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_ROOT = os.path.join(BASE_DIR, 'static')
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,9 @@ DATABASES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTALLED_APPS = INSTALLED_APPS + [
|
INSTALLED_APPS = [
|
||||||
|
'whitenoise.runserver_nostatic',
|
||||||
|
] + INSTALLED_APPS + [
|
||||||
'wagtail.contrib.wagtailstyleguide',
|
'wagtail.contrib.wagtailstyleguide',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,4 @@ https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from whitenoise.django import DjangoWhiteNoise
|
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
|
||||||
|
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "publichealth.settings.production")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "publichealth.settings.production")
|
||||||
|
|
||||||
application = DjangoWhiteNoise(get_wsgi_application())
|
|
||||||
|
|
Loading…
Reference in a new issue