Skip to content

Conversation

radwon
Copy link
Contributor

@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
Contributor 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
@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