python manage.py runserver直接报错,trace信息如下:
File "c:\python36\Lib\socketserver.py", line 453, in __init__
self.server_bind()
File "c:\python36\Lib\wsgiref\simple_server.py", line 50, in server_bind
HTTPServer.server_bind(self)
File "c:\python36\Lib\http\server.py", line 138, in server_bind
self.server_name = socket.getfqdn(host)
File "c:\python36\Lib\socket.py", line 673, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 2: invalid start byte
网上找不问题,跟到python36\Lib\socket.py文件里面,大概猜出来错误的原因:我的电脑命名用了中文。改成英文后,重启果然就好了。
相对于c#或者java,python真的坑很多,所以以后我把遇到的坑都share出来,仅供参考,希望python能越来越完善。