diff options
author | Ben Copeland <ben.copeland@linaro.org> | 2017-09-12 11:08:08 +0100 |
---|---|---|
committer | Ben Copeland <ben.copeland@linaro.org> | 2017-09-12 15:30:06 +0000 |
commit | 9ecf78923844d2cdbf924dfbadbec1f50d9f8f79 (patch) | |
tree | 109e15b0134dfd2f54e88b08b28580167835033a | |
parent | 834e0ea4f7bbeb1bd5c69b03f6a6506ddd8b6650 (diff) |
Static files: Use whitenoise
This allows us to serve static files from the gunicorn and maybe in
future can use a CDN
Change-Id: If20f4ce0abd2252ff65b7fead38aedc97bf19038
Reviewed-on: https://review.linaro.org/21369
Reviewed-by: Andy Doan <andy.doan@linaro.org>
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | settings.py | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/requirements.txt b/requirements.txt index ca7400d..7a94f29 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,3 +14,4 @@ testrepository psycopg2 textile django-openid-auth +whitenoise diff --git a/settings.py b/settings.py index 54d4665..217c628 100644 --- a/settings.py +++ b/settings.py @@ -66,6 +66,8 @@ STATIC_ROOT = os.path.join(PROJECT_ROOT, "static") # Example: "http://media.lawrence.com/static/" STATIC_URL = '/static/' +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' + # URL prefix for admin static files -- CSS, JavaScript and images. # Make sure to use a trailing slash. # Examples: "http://foo.com/static/admin/", "/static/admin/". @@ -99,6 +101,7 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', ) ROOT_URLCONF = 'urls' |