If you see "cannot import name 'ugettext_lazy'" in Django, Django 4.0 might be installed

Django
2021-12-11 13:51 (4 years ago)
If you see "cannot import name 'ugettext_lazy'" in Django, Django 4.0 might be installed

When you run manage.py hoge in Django

ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/lib/python3.8/site-packages/django/utils/translation/__init__.py)

If you encounter this error, it is possible that Django 4.0 is installed.

By the way, if you're installing dependencies with Pipenv in a Dockerfile, you can use the following commands:

COPY Pipfile /tmp/Pipfile
COPY Pipfile.lock /tmp/Pipfile.lock
...
RUN PIPENV_PIPFILE=/tmp/Pipfile pipenv install --system --ignore-pipfile --deploy

By adding the --ignore-pipfile option, the installation behavior will be similar to pipenv sync, which installs from the Pipfile.lock.

Current rating: 2.5 (2)
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive