Skip to content

Commit

Permalink
Configure Whitenoise for serving simple static assets
Browse files Browse the repository at this point in the history
  • Loading branch information
conatus committed Jan 4, 2024
1 parent ddcf55e commit 126c5f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions banmarchive/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',


'wagtail.contrib.redirects.middleware.RedirectMiddleware',
'banmarchive.middleware.canonical_host_redirect',
]
Expand Down
2 changes: 2 additions & 0 deletions banmarchive/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from .base import *
from urllib.parse import urlparse

STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

DEBUG = False
SECRET_KEY = os.getenv('SECRET_KEY')
BASE_URL = re.sub(r'/$', '', os.getenv('BASE_URL', ''))
Expand Down

0 comments on commit 126c5f1

Please sign in to comment.