Getting DEFAULT_FILE_STORAGE/STORAGES are mutually exclusive when upgraded to 4.2

234 views Asked by At

We are in process to upgrade to django 4.2. However we are facing above issue in running django peroject. We have already setup new way of STORAGES in settings.py i.e.

STORAGES = {
            "staticfiles": {"BACKEND": "custom.core.storage.GzipManifestStaticfilesStorage"},
            "default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
        }

But its not working and getting said error in running project. But, when we manually go and remove DEFAULT_FILE_STORAGE from django\conf\global_settings.py file then at least it doesn't give above issue. Any suggestion(s) how to fix it, thanks!

2

There are 2 answers

0
sAm On BEST ANSWER

Finally it's fixed. I had a silly mistake that i was still using django-configurations version 2.3.1 but once I moved to django-configurations version 2.5. Then issue is gone.

2
henningb On

In Django 4.2 DEFAULT_FILE_STORAGE are deprecated and replaced with STORAGES.

Just replace DEFAULT_FILE_STORAGE with STORAGES and keep the original value and you are good to go.

More info under:

https://docs.djangoproject.com/en/4.2/ref/settings/#default-file-storage