Skip to content

Commit

Permalink
Merge pull request #76 from andreparames/use-whitenoise-for-static-files
Browse files Browse the repository at this point in the history
Use whitenoise to serve static files
  • Loading branch information
adrianmcphee authored Oct 15, 2023
2 parents 397e98b + 00901ad commit 5288afe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ echo "Apply database migrations"
echo "----------------------------------------------------------"
nohup python manage.py migrate --run-syncdb

# Prepare static files
echo "Preparing static files"
echo "----------------------------------------------------------"
nohup python manage.py collectstatic

# Load Sample Data
# echo "Load Sample Data"
# echo "----------------------------------------------------------"
Expand Down
12 changes: 12 additions & 0 deletions openunited/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@

# When running in a DigitalOcean app, Django sits behind a proxy
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

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",
"debug_toolbar.middleware.DebugToolbarMiddleware",
]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ watchfiles==0.19.0
wcwidth==0.2.6
websockets==11.0.3
xlwt==1.3.0
whitenoise==6.6.0

0 comments on commit 5288afe

Please sign in to comment.