diff --git a/Pipfile b/Pipfile index d7bbe9e8..4e0989e6 100644 --- a/Pipfile +++ b/Pipfile @@ -12,6 +12,7 @@ pandas = "*" faker = "*" dj-database-url = "*" gunicorn = "*" +whitenoise = "*" [dev-packages] coveralls = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 4e88d4cf..119aba1c 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "52db700b9c061baeb935565e2910f5205547ba93306d53f12634b7a0a4c3cb02" + "sha256": "b9baed35cbefffb676928f6379dbeee78e94efa96382465afabc49c2e1685a44" }, "requires": {}, "sources": [ @@ -86,6 +86,9 @@ }, "urllib3": { "version": "==1.22" + }, + "whitenoise": { + "version": "==3.3.1" } }, "develop": { diff --git a/babybuddy/settings/base.py b/babybuddy/settings/base.py index 3e39a9ad..1fc618e6 100644 --- a/babybuddy/settings/base.py +++ b/babybuddy/settings/base.py @@ -36,6 +36,9 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', + + 'whitenoise.middleware.WhiteNoiseMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -104,6 +107,13 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' + +STATICFILES_FINDERS = [ + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +] + STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static')