django创建项目Python manage.py runserver报错
这里是报错,我是在官网下载django然后只做一少部分的操作,但是UnicodeDecodeError到底我在哪里用到ascii???为什么会报错?
Performing system checks...
System check identified no issues (0 silenced).
August 10, 2017 - 19:10:22
Django version 1.11.4, using settings 'myblog.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 0x036D74F8>
Traceback (most recent call last):
File "C:\python3\lib\site-packages\django\utils\autoreload.py", line 228, in w
rapper
fn(*args, **kwargs)
File "C:\python3\lib\site-packages\django\core\management\commands\runserver.p
y", line 149, in inner_run
ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
File "C:\python3\lib\site-packages\django\core\servers\basehttp.py", line 164,
in run
httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
File "C:\python3\lib\site-packages\django\core\servers\basehttp.py", line 74,
in __init__
super(WSGIServer, self).__init__(*args, **kwargs)
File "C:\python3\lib\socketserver.py", line 453, in __init__
self.server_bind()
File "C:\python3\lib\wsgiref\simple_server.py", line 50, in server_bind
HTTPServer.server_bind(self)
File "C:\python3\lib\http\server.py", line 138, in server_bind
self.server_name = socket.getfqdn(host)
File "C:\python3\lib\socket.py", line 673, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 2: invalid
continuation byte
myblog urls.py中只是按这种格式写入(include是后来改的,但之前形式和第一行相同,也删过r,也将u代替过r都没有用)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个罕见的问题...
一般来说编码错误是由中文引起的。从 traceback 最后一栈落在
gethostbyaddr
上可以看出:你电脑的主机名多半是设成了中文了。计算机->右键->属性
:如果此处是中文,把他改成英文