sAm
sAm

Reputation: 683

Getting DEFAULT_FILE_STORAGE/STORAGES are mutually exclusive when upgraded to 4.2

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!

Upvotes: 3

Views: 3121

Answers (2)

sAm
sAm

Reputation: 683

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.

Upvotes: 3

henningb
henningb

Reputation: 63

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

Upvotes: 1

Related Questions