fix: migrate STATICFILES_STORAGE to STORAGES (Django 5.2) #21
Reference in New Issue
Block a user
Delete Branch "fix/storages-django52"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Root cause of unstyled production site
Django 5.1 removed the
STATICFILES_STORAGEsetting in favour of theSTORAGESdict. On Django 5.2, the old setting was silently ignored, causing Django to fall back to the defaultStaticFilesStorageinstead ofCompressedManifestStaticFilesStorage.Effects:
styles.abc123.css)staticfiles.jsonmanifest written{% static %}tag returns plain/static/css/styles.csswith no cache busting/static/css/styles.csswith a 4-hour TTL — old CSS served to users after deploy until cache expiresFix: Replace
STATICFILES_STORAGEwithSTORAGESdict in bothbase.pyanddevelopment.py.After this merges and deploys,
collectstaticwill create hashed filenames (styles.{hash}.css), writestaticfiles.json, and{% static %}will return versioned URLs that Cloudflare caches indefinitely with automatic cache busting on content change.