Skip to content

Commit

Permalink
added whitenoise for static files
Browse files Browse the repository at this point in the history
  • Loading branch information
bugman80 committed Jan 14, 2025
1 parent d9b1466 commit 7117e1a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bookinghub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"corsheaders.middleware.CorsMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
]

CSRF_TRUSTED_ORIGINS = [
Expand Down Expand Up @@ -161,6 +162,7 @@
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
Expand Down
5 changes: 4 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ python manage.py wait_for_db
# Eseguo le migrazioni
python manage.py migrate

# Eseguo il collectstatic
python manage.py collectstatic --noinput

# Eseguo il comando di gestione personalizzato
python manage.py create_superuser_if_not_exists

# Avvio il server
python manage.py runserver 0.0.0.0:8000
exec gunicorn bookinghub.wsgi:application --workers 4 --threads 2 --bind 0.0.0.0:8000
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ pytz==2024.2
PyYAML==6.0.2
sqlparse==0.5.1
uritemplate==4.1.1
whitenoise==6.8.2

0 comments on commit 7117e1a

Please sign in to comment.