我正试图在带有PostGreSQL数据库的服务器上部署Django应用程序(2.1.5和python3.6.6)。 我不能像往常一样创建一个超级用户迁移
[alex@web574 myproject]$ python3.6 manage.py createsuperuser
Nom d'utilisateur (leave blank to use 'alex'):
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/home/alex/webapps/global_hse_project/lib/python3.6/Django-2.1.5-py3.6.egg/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/alex/webapps/global_hse_project/lib/python3.6/Django-2.1.5-py3.6.egg/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/alex/webapps/global_hse_project/lib/python3.6/Django-2.1.5-py3.6.egg/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/alex/webapps/global_hse_project/lib/python3.6/Django-2.1.5-py3.6.egg/django/contrib/auth/management/commands/createsuperuser.py", line 60, in execute
return super().execute(*args, **options)
File "/home/alex/webapps/global_hse_project/lib/python3.6/Django-2.1.5-py3.6.egg/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/home/alex/webapps/global_hse_project/lib/python3.6/Django-2.1.5-py3.6.egg/django/contrib/auth/management/commands/createsuperuser.py", line 139, in handle
input_value = self.get_input_data(field, message)
File "/home/alex/webapps/global_hse_project/lib/python3.6/Django-2.1.5-py3.6.egg/django/contrib/auth/management/commands/createsuperuser.py", line 194, in get_input_data
raw_value = input(message)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 8: ordinal not in range(128)
我在谷歌上发现:
^{pr2}$在文件的顶部,但它不起作用,结果与变量DEFAULT CHARSET(https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-DEFAULT_CHARSET)相同。 我的PostGreSQL数据库要求utf-8编码。在
我认为这和这里的问题是一样的: previous post 你必须补充
在每个文件的开头包含正确的编码
这可能是由于用于stdin的编码不支持在
input()
提示符处键入的字符。在在运行} 环境变量显式地将编码设置为
createsuperuser
命令之前,可以尝试使用^{UTF-8
:相关问题 更多 >
编程相关推荐