Serving Static Files with WhiteNoise
A snippet showing how to integrate WhiteNoise for static files.
# settings.py
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
# ...
]
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
Explanation:
-
WhiteNoiseallows Django to serve compressed static files in production.
- Category Static & Media Files
- Total Views 948
- Last Modified 20 April, 2026
- Tags #static #whitenoise #deployment #files
Previous snippet
Custom File Upload Path
Next snippet