Skip to content

ugettext_lazy is removed from Django 4 #5

@zyunx

Description

@zyunx

I use Django 4.

The below error occurs, when I use this lib.

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/Users/yun/Workshop/Projects/zelixir-enterprise/zelixir-server-enterprise/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/Users/yun/Workshop/Projects/zelixir-enterprise/zelixir-server-enterprise/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/Users/yun/Workshop/Projects/zelixir-enterprise/zelixir-server-enterprise/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/yun/Workshop/Projects/zelixir-enterprise/zelixir-server-enterprise/venv/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/Users/yun/Workshop/Projects/zelixir-enterprise/zelixir-server-enterprise/venv/lib/python3.8/site-packages/django/apps/config.py", line 126, in create
    mod = import_module(mod_path)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/yun/Workshop/Projects/zelixir-enterprise/zelixir-server-enterprise/venv/lib/python3.8/site-packages/distributedlock/apps.py", line 2, in <module>
    from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/Users/yun/Workshop/Projects/zelixir-enterprise/zelixir-server-enterprise/venv/lib/python3.8/site-packages/django/utils/translation/__init__.py)

The cause are that ugettext_lazy is removed from Django 4

Ref:
https://stackoverflow.com/questions/70656495/importerror-cannot-import-name-ugettext-lazy
https://code.djangoproject.com/ticket/30165

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions