revsys / django-health-check

a pluggable app that runs a full check on the deployment, using a number of plugins to check e.g. database, queue server, celery processes, etc.

Home Page:https://readthedocs.org/projects/django-health-check/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ugettext_lazy has been removed in Django 4.0

MatinKarbasioun opened this issue · comments

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?

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