-
Notifications
You must be signed in to change notification settings - Fork 69
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
Unexpected RemovedInDjango51Warning due to the import of get_storage_class #115
Comments
Can this be fixed in a backwards compatible fashion? |
@timthelion I'm going to create a pull request in a few minutes which fits with all versions 😃 |
JMSoler7
added a commit
to JMSoler7/django-import-export-celery
that referenced
this issue
Feb 19, 2024
…modules instead of deprecated method In Django documentation we can see that get_storage_class is deprecated in Django 5.1 and later. https://docs.djangoproject.com/en/5.0/ref/files/storage/#django.core.files.storage.get_storage_class Recommendation of Django is to use storages instead of get_storage_class. This leads to specify this file storage backend in STORAGES config settings instead of a new config variable. This commit allows also to keep using custom storage classe from older verions (4.2 and earlier) and prevents to crash when invalid storage class is provided, using the default one. Solves auto-mat#115
@JMSoler7 The logic of the PR seems to me to be quite harmful. I have written a comment on the PR, but there are other problems:
|
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This method from the django.core.files.storage module is deprecated as of Django 5.1.
It's easy to reproduce; simply define a custom IMPORT_EXPORT_CELERY_STORAGE in the config settings and reload the application:
/app/.venv/lib/python3.11/site-packages/import_export_celery/fields.py:10: RemovedInDjango51Warning: django.core.files.storage.get_storage_class is deprecated in favor of using django.core.files.storage.storages. storage_class = get_storage_class(settings.IMPORT_EXPORT_CELERY_STORAGE)
Upon inspecting the Django documentation (https://docs.djangoproject.com/en/5.0/ref/files/storage/#django.core.files.storage.get_storage_class), there is an explanation to use storages (https://docs.djangoproject.com/en/5.0/ref/files/storage/#django.core.files.storage.storages) instead of the get_storage_class method.
The text was updated successfully, but these errors were encountered: