Skip to content

Commit

Permalink
fix: Incorrect setup for static file in production (#16)
Browse files Browse the repository at this point in the history
- add the whitenoise dependency for serving static files in production
  • Loading branch information
karuhanga authored and malep2007 committed Jan 31, 2019
1 parent cc24dc6 commit 3167fee
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions authors/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
Expand Down
3 changes: 3 additions & 0 deletions authors/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
3 changes: 3 additions & 0 deletions authors/settings/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3167fee

Please sign in to comment.