Skip to content

Commit

Permalink
Add whitenoise for serving static files
Browse files Browse the repository at this point in the history
  • Loading branch information
frankh committed Feb 17, 2017
1 parent e1a64e5 commit 831fd63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cabot/settings.py
Expand Up @@ -81,6 +81,9 @@
# Additional locations of static files
STATICFILES_DIRS = [os.path.join(PROJECT_ROOT, 'static')]

if not DEBUG:
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
Expand Down Expand Up @@ -111,6 +114,7 @@
}]

MIDDLEWARE_CLASSES = (
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
Expand All @@ -120,7 +124,6 @@
)

ROOT_URLCONF = 'cabot.urls'

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -29,3 +29,4 @@ twilio==3.4.1
wsgiref==0.1.2
python-dateutil==2.1
django-auth-ldap==1.2.6
whitenoise==3.3.0

0 comments on commit 831fd63

Please sign in to comment.