运行 Django 应用程序时出错 [英] Error while running Django app
问题描述
当我在 pycharm 或 cmd 中运行 django 项目时,出现此错误.我该怎么办?
When I run django project in pycharm or cmd, I get this error. What Should I do?
"C:Program Files (x86)JetBrainsPyCharm 3.4.1in unnerw.exe" C:Python34python.exe C:/Users/admin/PycharmProjects/untitled/manage.py runserver 8000正在验证模型...
"C:Program Files (x86)JetBrainsPyCharm 3.4.1in unnerw.exe" C:Python34python.exe C:/Users/admin/PycharmProjects/untitled/manage.py runserver 8000 Validating models...
0 errors found
August 15, 2014 - 13:58:27
Django version 1.6.5, using settings 'untitled.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x022A32B8>
Traceback (most recent call last):
File "C:Python34libsite-packagesdjangoutilsautoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "C:Python34libsite-packagesdjangocoremanagementcommands
unserver.py", line 127, in inner_run
ipv6=self.use_ipv6, threading=threading)
File "C:Python34libsite-packagesdjangocoreserversasehttp.py", line 167, in run
httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
File "C:Python34libsite-packagesdjangocoreserversasehttp.py", line 109, in __init__
super(WSGIServer, self).__init__(*args, **kwargs)
File "C:Python34libsocketserver.py", line 429, in __init__
self.server_bind()
File "C:Python34libsite-packagesdjangocoreserversasehttp.py", line 113, in server_bind
super(WSGIServer, self).server_bind()
File "C:Python34libwsgirefsimple_server.py", line 50, in server_bind
HTTPServer.server_bind(self)
File "C:Python34libhttpserver.py", line 135, in server_bind
self.server_name = socket.getfqdn(host)
File "C:Python34libsocket.py", line 460, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 6: invalid continuation byte
推荐答案
我没有测试过,但我想这是一个 python 错误.您提供的堆栈跟踪表明,当您的主机名被复制到 python unicode 字符串中时,将触发 UnicodeDecodeError.
I have not tested it, but I suppose this is a python error. The stack trace you have provided suggests, that the UnicodeDecodeError gets triggerd when your hostname gets copied into a python unicode string.
请检查您正在使用的机器的主机名是否包含 unicode 字符.
Please check if the hostname of the machine you are working on contains unicode characters.
这似乎与您的问题相同.在帖子中,python Issue9377 被引用,它仍然处于打开状态.
This seems to be the same issue as yours. In the post the python Issue9377 is referenced which is still open.
这篇关于运行 Django 应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!