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

ImportError is raised when running from command line #432

Open
VBobCat opened this issue Mar 25, 2022 · 2 comments
Open

ImportError is raised when running from command line #432

VBobCat opened this issue Mar 25, 2022 · 2 comments

Comments

@VBobCat
Copy link

VBobCat commented Mar 25, 2022

Bug Report

Describe the bug

ImportError is raised when running python manage.py dbbackup from command line

To Reproduce

  1. install with pip install django-dbbackup
  2. add app 'dbbackup' to INSTALLED_APPS list in settings.py
  3. add DBBACKUP_STORAGE and DBBACKUP_STORAGE_OPTIONS vars to settings.py as per docs setting the latter to an existing path in filesystem
  4. run python manage.py dbbackup from command line

Expected behavior

Backup file to be created at appointed folder

Screenshots or reproduction

C:\...>python manage.py dbbackup

Traceback (most recent call last):
  File "C:\...\manage.py", line 22, in <module>
    main()
  File "C:\...\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\...\venv\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "C:\...\venv\lib\site-packages\django\core\management\__init__.py", line 420, in execute
    django.setup()
  File "C:\...\venv\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\...\venv\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "C:\...\venv\lib\site-packages\django\apps\config.py", line 126, in create
    mod = import_module(mod_path)
  File "C:\Program Files\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\...\venv\lib\site-packages\dbbackup\apps.py", line 3, in <module>
    from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (C:\...\venv\lib\site-packages\django\utils\translation\__init__.py)

Versions

Django-dbbackup

  • pypi: 3.3.0

External tools

  • Python: 3.10.3
  • Django: 4.0.3
  • OS: Windows 10 64bit
@Jamshidboltaboyev
Copy link

I know one solution, but that not good idea!
Soo, dbbackup use ugettext_lazy, but now django v4 use only gettext_lazy.
ugettext_lazy = gettext_lazy add
venv\lib\python3.10\site-packages\django\utils\translation_init_.py line 112

@Shriukan33
Copy link

Shriukan33 commented Jun 20, 2022

I know one solution, but that not good idea! Soo, dbbackup use ugettext_lazy, but now django v4 use only gettext_lazy. ugettext_lazy = gettext_lazy add venv\lib\python3.10\site-packages\django\utils\translation__init__.py line 112

Alternatively, you can install the pre-release :
https://pypi.org/project/django-dbbackup/4.0.0b0/

It does support Django 4.

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

No branches or pull requests

3 participants