Home » Odeon Blogs » Pyro »

Locale error in manage.py createsuperuser

Locale error in manage.py createsuperuser

Recently, when I run python manage.py createsuperuser, I run into this problem

  1. return getpass.getuser().decode(locale.getdefaultlocale()[1])
  2. 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.
  1. export LANG=en_US.UTF-8
  2. export LC_ALL=en_US.UTF-8
Now, createsuperuser command runs successfully.


Categories: Django locale


Tagged as: django locale

Discussion

  1. Oluwaseun Leo on Apr 24, 2012 - 13:25 said:

    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?


  2. And that should be it. You should be able to run `./manage.py createsuperuser` with no errors.

    Make sure you `source ~/.bashrc` first though.




Leave a Comment :

(required)


(required)




(required)




(required)






Leave a Comment


Page generated in: 0.15s