python3.x - django创建项目Python manage.py runserver报错
本文介绍了python3.x - 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都没有用)
解决方案
这是一个罕见的问题...
一般来说编码错误是由中文引起的。从 traceback 最后一栈落在 gethostbyaddr
上可以看出:你电脑的主机名多半是设成了中文了。
计算机->右键->属性
:
如果此处是中文,把他改成英文
这篇关于python3.x - django创建项目Python manage.py runserver报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文