运行 python runserver语言 - -nothreading -noreload 时出错


/home/saumen/.local/lib/python2.7/site-packages/django/core/management/__init__.py:316: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if subcommand == 'runserver' and '--noreload' not in self.argv:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 61, in execute
super(Command, self).execute(*args, **options)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/saumen/.local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 86, in handle
'or address:port pair.' % options['addrport'])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

当我运行python运行服务器--nothreading -noreload时,我收到错误。我已经安装了mysqlclient和必要的python库。

首先编辑你的答案并将代码放在第 86 行... 并且由于UnicodeDecodeError而发生错误:

这可能对您有用:(注意:your_string是您要解码的内容(

your_String.encode('ascii', 'ignore').decode('utf-8')

有关您的问题的更具体内容:

str(options['addrport']).encode('ascii', 'ignore').decode('utf-8')

最新更新