feat: Add WhiteNoise for optimized static file serving
This commit is contained in:
parent
28595c8f0f
commit
ddf28fea79
@ -76,6 +76,7 @@ INSTALLED_APPS = [
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware", # Add WhiteNoise Middleware
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
@ -181,6 +182,10 @@ STATICFILES_DIRS = [
|
||||
BASE_DIR / 'node_modules',
|
||||
]
|
||||
|
||||
# Enable WhiteNoise's Gzip compression of static assets.
|
||||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||
|
||||
|
||||
# Media files
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = BASE_DIR / 'media'
|
||||
|
||||
@ -11,4 +11,4 @@ drf-yasg
|
||||
gunicorn==22.0.0
|
||||
django-cors-headers
|
||||
django-admin-rangefilter
|
||||
requests
|
||||
requestswhitenoise
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user