简体   繁体   English

Django服务器无法运行

[英]Django server won't run

I just tries to start django project on win7(x64), but i faced with following issue: 我只是想在win7(x64)上启动django项目,但遇到了以下问题:

$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
March 24, 2018 - 14:24:08
Django version 1.11.3, using settings 'superlists.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 0x035BD978>
Traceback (most recent call last):
  File "C:\Users\alesya\.virtualenvs\superlists\lib\site-packages\django\utils\a
utoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\alesya\.virtualenvs\superlists\lib\site-packages\django\core\ma
nagement\commands\runserver.py", line 149, in inner_run
    ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
  File "C:\Users\alesya\.virtualenvs\superlists\lib\site-packages\django\core\se
rvers\basehttp.py", line 164, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\Users\alesya\.virtualenvs\superlists\lib\site-packages\django\core\se
rvers\basehttp.py", line 74, in __init__
    super(WSGIServer, self).__init__(*args, **kwargs)
  File "c:\users\alesya\appdata\local\programs\python\python36-32\Lib\socketserv
er.py", line 453, in __init__
    self.server_bind()
  File "c:\users\alesya\appdata\local\programs\python\python36-32\Lib\wsgiref\si
mple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "c:\users\alesya\appdata\local\programs\python\python36-32\Lib\http\serve
r.py", line 138, in server_bind
    self.server_name = socket.getfqdn(host)
  File "c:\users\alesya\appdata\local\programs\python\python36-32\Lib\socket.py"
, line 673, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 14: invalid
 start byte

My computer has an ASCII name, so I even not realized, what happens. 我的计算机有一个ASCII名称,所以我什至不知道发生了什么。 Did all these things on another win7 and everything was ok. 所有这些事情都在另一个win7上完成了,一切都还好。 Maybe someone can help with? 也许有人可以帮助您?

UPD. UPD。 My problem was due to the changed 'hosts' file - there are a lot of disabled addresses. 我的问题是由于更改了“主机”文件-有很多禁用的地址。 Thanks all for the answers. 谢谢大家的回答。

使用python3,如果您使用python2.x,许多字母(例如重音符号或其他字母)会导致异常崩溃

try this: 尝试这个:

a.encode('utf-8').strip()

if "a" is the string with non-ascii character 如果“ a”是具有非ASCII字符的字符串

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM