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

Does not work with Django 5.1 because get_storage_class is deprecated and removed. #523

Closed
jlandercy opened this issue Aug 15, 2024 · 3 comments · Fixed by #524
Closed
Labels
bug Bugs that need to get fixed.

Comments

@jlandercy
Copy link

Current Situation

Django DBBackup relies on function get_storage_class which is deprecated since version Django>=4.2 and has been removed in Django 5.1.

python manage.py dbbackup
Traceback (most recent call last):
  File "C:\Users\developer\PycharmProjects\myrcd\myrcd\myrcd\manage.py", line 22, in <module>
    main()
  File "C:\Users\developer\PycharmProjects\myrcd\myrcd\myrcd\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\developer\.conda\envs\myrcd\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "C:\Users\developer\.conda\envs\myrcd\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\developer\.conda\envs\myrcd\Lib\site-packages\django\core\management\__init__.py", line 275, in fetch_command
    klass = load_command_class(app_name, subcommand)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\developer\.conda\envs\myrcd\Lib\site-packages\django\core\management\__init__.py", line 48, in load_command_class
    module = import_module("%s.management.commands.%s" % (app_name, name))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\developer\.conda\envs\myrcd\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\developer\.conda\envs\myrcd\Lib\site-packages\dbbackup\management\commands\dbbackup.py", line 9, in <module>
    from ...storage import StorageError, get_storage
  File "C:\Users\developer\.conda\envs\myrcd\Lib\site-packages\dbbackup\storage.py", line 7, in <module>
    from django.core.files.storage import get_storage_class
ImportError: cannot import name 'get_storage_class' from 'django.core.files.storage' (C:\Users\developer\.conda\envs\myrcd\Lib\site-packages\django\core\files\storage\__init__.py)     

Proposed Actions

Make use of Storages instead as described in documentation

System Information

Django==5.1
django-dbbackup==4.1.0

@jlandercy jlandercy added the bug Bugs that need to get fixed. label Aug 15, 2024
@P1nk-L0rD
Copy link

Same error

1 similar comment
@tarlansoltanov
Copy link

Same error

@jlandercy
Copy link
Author

Thank you for solving this issue, it works as expected with version 4.2.1. Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs that need to get fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants