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

ugettext_lazy has been removed in Django 4.0 #345

Open
MatinKarbasioun opened this issue Dec 19, 2022 · 1 comment
Open

ugettext_lazy has been removed in Django 4.0 #345

MatinKarbasioun opened this issue Dec 19, 2022 · 1 comment

Comments

@MatinKarbasioun
Copy link

MatinKarbasioun commented Dec 19, 2022

Hello Guys,
When I use Django 4.1.4 this error is raised:

ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (...\venv\Lib\sitepackages\django\utils\translation\__init__.py)

Can you help me?

@yalattas
Copy link

yalattas commented Apr 3, 2023

same

Error trace

2023-04-03 13:31:26,552 P7288 [INFO] Command 01_migrate
2023-04-03 13:31:27,238 P7288 [INFO] -----------------------Command Output-----------------------
2023-04-03 13:31:27,239 P7288 [INFO] 	Traceback (most recent call last):
2023-04-03 13:31:27,239 P7288 [INFO] 	  File "manage.py", line 22, in <module>
2023-04-03 13:31:27,239 P7288 [INFO] 	    main()
2023-04-03 13:31:27,239 P7288 [INFO] 	  File "manage.py", line 18, in main
2023-04-03 13:31:27,239 P7288 [INFO] 	    execute_from_command_line(sys.argv)
2023-04-03 13:31:27,240 P7288 [INFO] 	  File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
2023-04-03 13:31:27,240 P7288 [INFO] 	    utility.execute()
2023-04-03 13:31:27,240 P7288 [INFO] 	  File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/core/management/__init__.py", line 420, in execute
2023-04-03 13:31:27,240 P7288 [INFO] 	    django.setup()
2023-04-03 13:31:27,240 P7288 [INFO] 	  File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
2023-04-03 13:31:27,240 P7288 [INFO] 	    apps.populate(settings.INSTALLED_APPS)
2023-04-03 13:31:27,240 P7288 [INFO] 	  File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
2023-04-03 13:31:27,241 P7288 [INFO] 	    app_config = AppConfig.create(entry)
2023-04-03 13:31:27,241 P7288 [INFO] 	  File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/apps/config.py", line 123, in create
2023-04-03 13:31:27,241 P7288 [INFO] 	    mod = import_module(mod_path)
2023-04-03 13:31:27,241 P7288 [INFO] 	  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
2023-04-03 13:31:27,241 P7288 [INFO] 	    return _bootstrap._gcd_import(name[level:], package, level)
2023-04-03 13:31:27,241 P7288 [INFO] 	  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2023-04-03 13:31:27,241 P7288 [INFO] 	  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2023-04-03 13:31:27,241 P7288 [INFO] 	  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2023-04-03 13:31:27,241 P7288 [INFO] 	  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2023-04-03 13:31:27,242 P7288 [INFO] 	  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
2023-04-03 13:31:27,242 P7288 [INFO] 	  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2023-04-03 13:31:27,242 P7288 [INFO] 	  File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/health_check/apps.py", line 5, in <module>
2023-04-03 13:31:27,242 P7288 [INFO] 	    from django.utils.translation import ugettext_lazy as _
2023-04-03 13:31:27,242 P7288 [INFO] 	ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/utils/translation/__init__.py)

references

ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/django/utils/translation/__init__.py)

django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(), ungettext(), and ungettext_lazy() are deprecated in favor of the functions that they’re aliases for: [django.utils.translation.gettext()]

(https://docs.djangoproject.com/en/3.0/ref/utils/#django.utils.translation.gettext), gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy().

https://docs.djangoproject.com/en/3.0/internals/deprecation/

https://docs.djangoproject.com/en/3.0/releases/3.0/#id3

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

2 participants