When I tried to create a superuser by running python manage.py syncdb
, I sometimes got an error saying ValueError: unknown local: UTF-8
.
This seems to happen if the environment variables checked in python are not set properly. So
python
export LANG=ja_JP.UTF-8
export LC_COLLATE=ja_JP.UTF-8
export LC_CTYPE=ja_JP.UTF-8
export LC_MESSAGES=ja_JP.UTF-8
export LC_MONETARY=ja_JP.UTF-8
export LC_NUMERIC=ja_JP.UTF-8
export LC_TIME=ja_JP.UTF-8
export LC_ALL=
To .zshrc
python -c 'import locale; print(locale.getdefaultlocale());'
Is executed and if ('ja_JP','UTF8')
is output, the countermeasure is completed.
Recommended Posts