diff --git a/authors/settings/base.py b/authors/settings/base.py index 84ac770..803a6a3 100644 --- a/authors/settings/base.py +++ b/authors/settings/base.py @@ -46,6 +46,7 @@ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/authors/settings/production.py b/authors/settings/production.py index d57372d..755e9ec 100644 --- a/authors/settings/production.py +++ b/authors/settings/production.py @@ -11,3 +11,6 @@ DATABASES = { 'default': dj_database_url.config(env='DATABASE_URL', engine='django.db.backends.postgresql') } + +# allow static file compression +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' diff --git a/authors/settings/staging.py b/authors/settings/staging.py index 5564b27..0ce3c11 100644 --- a/authors/settings/staging.py +++ b/authors/settings/staging.py @@ -11,3 +11,6 @@ DATABASES = { 'default': dj_database_url.config(env='STAGING_DATABASE_URL', engine='django.db.backends.postgresql') } + +# allow static file compression +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' diff --git a/requirements.txt b/requirements.txt index 9317ae7..4af90c1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,3 +26,4 @@ ruamel.yaml==0.15.87 six==1.12.0 uritemplate==3.0.0 urllib3==1.24.1 +whitenoise==4.1.2