django creationuperuser不工作 [英] django createsuperuser not working
问题描述
export PATH="/Applications/MAMP/bin:/usr/local/bin:/usr/local/sbin:usr/local/$
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
export LANG="en_US.UTF-8"
.profile
.profile
export PATH="/Applications/MAMP/bin:/usr/local/bin:/usr/local/sbin:usr/local/my$
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
export LANG="en_US.UTF-8"
错误
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.6/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 70, in handle
default_username = get_default_username()
File "/Library/Python/2.6/site-packages/django/contrib/auth/management/__init__.py", line 105, in get_default_username
default_username = get_system_username()
File "/Library/Python/2.6/site-packages/django/contrib/auth/management/__init__.py", line 85, in get_system_username
return getpass.getuser().decode(locale.getdefaultlocale()[1])
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/locale.py", line 459, in getdefaultlocale
return _parse_localename(localename)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/locale.py", line 391, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
怀疑
我将LANG更改为UTF-8,但仍然无法解决问题,请帮助
doubt
i changed my LANG to UTF-8 also but still i am not able to solve the problem , please help
推荐答案
您正在看到这一点,因为您的系统上没有设置区域设置。您需要设置它以创建超级用户,它已知并已报告错误。
You are seeing this because you don't have locale set on your system. You need to set it in order to create superuser, it's known and reported "bug" already.
请参阅:
https://code.djangoproject.com/ticket/17649
假设你使用的是linux您可以使用
Assuming that you're using linux you can fix that bug with
export LANG="en_US.UTF-8"
您可以在终端中使用此功能,但您可以轻松地查看如何更改系统上的区域设置,只需使用Google搜索。
You use this in terminal, but you can easily check and see how to change locales on your system just googling.
如果您使用的是:
Ubuntu - https://help.ubuntu.com/community/Locale/
Ubuntu - https://help.ubuntu.com/community/Locale/
Archlinux - https://wiki.archlinux.org/index.php/Locale
Archlinux - https://wiki.archlinux.org/index.php/Locale
...
这篇关于django creationuperuser不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!