Locale error in manage.py createsuperuser
Recently, when I run python manage.py createsuperuser, I run into this problem
return getpass.getuser().decode(locale.getdefaultlocale()[1])
TypeError: decode() argument 1 must be string, not None
Frustrated, I traced back why this is happening. It turns out that Python cannot detect default locale in my system. Therefore, locale.getdefaultlocale() is returning None and hence, causing the error. The solution is to set some locale variables in my environment.
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Now, createsuperuser command runs successfully.
Categories:
Django
locale
Tagged as:
django
locale
Discussion
So what do you do next. For example I am running mac os x 10.5 and python 2.5, so I set this in my bash profile for example and what do I do next?
And that should be it. You should be able to run `./manage.py createsuperuser` with no errors.
Make sure you `source ~/.bashrc` first though.
Thank you!!
Great post. Saved me a ton of time. Thanks.
Thank you!
Hey!! I have had this problem for months now. Great post... saved me on configuring my lettuce tests!
Leave a Comment :
Leave a Comment