Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new STORAGES setting in Django 4.2 #1759

Merged
merged 2 commits into from Apr 9, 2023
Merged

Conversation

radwon
Copy link
Member

@radwon radwon commented Apr 9, 2023

In Django 4.2 the django.core.files.storage.get_storage_class() function is deprecated as well as the STATICFILES_STORAGE setting in favor of STORAGES["staticfiles"].

Use django.core.files.storage.storages to get the configured storage class for static files instead.

For Django versions prior to 4.2 keep using the django.core.files.storage.get_storage_class() function for backwards compatibility.

Fixes #1758

In Django 4.2 the django.core.files.storage.get_storage_class() function is deprecated as well as the STATICFILES_STORAGE setting in favor of STORAGES["staticfiles"].

Use django.core.files.storage.storages to get the configured storage class for static files instead.

For Django versions prior to 4.2 keep using the django.core.files.storage.get_storage_class() function for backwards compatibility.

Fixes #1758
Copy link
Member

@matthiask matthiask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. I also think that the existing tests already cover "enough" of the behavior so that new tests aren't strictly necessary. A note in docs/changes.rst would be great, though!

Use the new STORAGES setting in Django 4.2

In Django 4.2 the django.core.files.storage.get_storage_class() function
is deprecated as well as the STATICFILES_STORAGE setting in favor of
STORAGES["staticfiles"].

Use django.core.files.storage.storages to get the configured storage
class for static files instead.

For Django versions prior to 4.2 keep using the
django.core.files.storage.get_storage_class() function for backwards
compatibility.

Fixes #1758
@radwon
Copy link
Member Author

radwon commented Apr 9, 2023

I've added a note in docs/changes.rst to include the update.

@matthiask matthiask merged commit 7ededd2 into main Apr 9, 2023
41 checks passed
@matthiask
Copy link
Member

Thanks!

@matthiask matthiask deleted the django42-storages branch April 9, 2023 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The STATICFILES_STORAGE setting is deprecated in Django 4.2
2 participants