What to do if you get angry with "Value Error: unknown local: UTF-8" in python manage.py syncdb

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.

reference

Recommended Posts

What to do if you get angry with "Value Error: unknown local: UTF-8" in python manage.py syncdb
What to do if you get an error when installing python with pyenv
What to do if you get "coverage unknown" in Coveralls
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you run python in IntelliJ and end with an error
What to do if you get a minus zero in Python
What to do if you get Swagger-codegen in python and Import Error: No module named
What to do if you get angry in TensorFlow v2 without attribute'app'
What to do if you get a "No versions found" error in pipenv
What to do if you get angry with swapon failed: Operation not permitted
What to do if you get "Python not configured." Using PyDev in Eclipse
What to do if you get an "unknown service" error from your gRPC server
What to do if you get `No kernel for language python found` in Hydrogen
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if you can't install pyaudio with pip #Python
What to do if you get a UnicodeDecodeError with pip install
What to do if you get a Call with too many input arguments error at DoAndReturn in a golang test
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if you get an error when running "certbot renew" in CakePHP environment
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if you get angry with'vertices' must be a 2D list ... in matplotlib arrow
What to do if you get an error saying c compiler cannot create executables in configure
What to do if you get a must override `get_config` error when trying to model.save in Keras
What to do if you couldn't send an email to Yahoo with Python.
What to do if you can't use scikit grid search in Python
What to do if the server doesn't start with python manage.py runserver
What to do if you get a TypeError with numpy min, max
What to do if you get an error when trying to load mnist
What to do if you can't install with pip in babun environment
What to do if you get Could not fetch URL 443 with pip
What to do if you get an error when installing Dlib (Ubuntu)
What to do to get google spreadsheet in python
What to do if you get angry with "Gtk * backend requires pygtke to be installed" even though pygtk is included in matplotlib
What to do if you get an error like'Qstring' has already been set to version 1 using mne python
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
What to do if a Unicode Encode Error occurs in Sublime Text Python
[Python] What to check when you get a Unicode Decode Error in Django
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if the print command itself causes an error in Maya python
What to do if Sort imports get stuck in VS Code's Python Extension (around 2020/09)
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do if you can't hit the arrow keys in the Python interactive console
What to do if you get the error Input contains NaN, infinity or a value too large for dtype ('float64'). In machine learning
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
What to do if you can't sort files with subscripts
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do if you can't log in as root
What to do if you get the error "Error: opencv3: Does not support building both Python 2 and 3 wrappers" when installing openCV 3
What to do with PYTHON release?
Python | What you can do with Python
What to do if Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: windows-31j occurs in PyCharm
What to do if you can't build your project with Maven
What to do if you can't use the trash in Lubuntu 18.04.
What to do when the value type is ambiguous in Python?
What to do if you get angry if you don't have libxml / xmlversion.h when installing lxml on CentOS