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

Django
2021-12-11 22:51 (3 years ago) ytyng

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

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011