So, you’ve finally upgraded your project to Django 5.1, everything works perfectly on your local machine with DEBUG=True, but the moment you push to production and set DEBUG=False, boom: Server Error (500). You check the logs and see this annoying message: AttributeError: 'Settings' object has no attribute 'STATICFILES_STORAGE'.
Don't worry, you haven't broken anything. You’ve just stepped into a "compatibility gap" between Django 5.1’s modernization and older libraries like django-cloudinary-storage. Here is exactly why this happens and the most "human-friendly" way to fix it.
The "Why": Django is Evolving, Libraries are Not
In Django 5.1, the old STATICFILES_STORAGE and DEFAULT_FILE_STORAGE settings were officially deprecated and replaced by a much cleaner STORAGES dictionary.
The headache starts here: Many popular libraries (like Cloudinary) still have hardcoded checks for that old STATICFILES_STORAGE variable. When they can't find it in your settings.py, they throw an AttributeError and crash your server.
The Fix: Modern Settings with a "Dummy" Twist
To fix this, we need to satisfy both Django 5.1’s new rules and the old requirements of our libraries.
Step 1: Set Up the Modern STORAGES
Update your settings.py to use the new dictionary. In this setup, we keep our media (images/videos) on Cloudinary while using WhiteNoise to serve our static files (CSS/JS) for better performance.
python1 2# settings.py 3 4STORAGES = { 5 "default": { 6 "BACKEND": "cloudinary_storage.storage.MediaCloudinaryStorage", 7 }, 8 "staticfiles": { 9 "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", 10 }, 11}
Step 2: The "Magic" Dummy Variable
To stop the library from complaining, we need to add a "dummy" variable that points to our static storage. Even though Django won't use this, the library will see it and stop crashing. Add this right below your STORAGES block:
python1 2# Django 5.1 ignores this, but libraries look for it to avoid AttributeErrors! 3STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
Step 3: Run Collectstatic
Now that the configuration is solid, you need to tell your server to gather and compress all your static files. Run this command in your terminal:
bash1 2python manage.py collectstatic --noinput
The Result
By following these steps:
-
You satisfy the Django 5.1 upgrade requirements.
-
You bypass library compatibility issues.
-
You gain performance by serving static files via WhiteNoise while keeping your media on Cloudinary.
Now you can safely set DEBUG=False and get your project back online. Happy deploying!

