线程django-main-thread中的异常:

时间:2019-12-09 08:49:46

标签: django

很多时间我没有输入我的项目。 当我打开它时,我得到的是:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "c:\program files (x86)\python37-32\Lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "c:\program files (x86)\python37-32\Lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\4\env\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "C:\4\env\lib\site-packages\django\core\management\commands\runserver.py", line 139, in inner_run
    ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
  File "C:\4\env\lib\site-packages\django\core\servers\basehttp.py", line 203, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\4\env\lib\site-packages\django\core\servers\basehttp.py", line 67, in __init__
    super().__init__(*args, **kwargs)
  File "c:\program files (x86)\python37-32\Lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "c:\program files (x86)\python37-32\Lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "c:\program files (x86)\python37-32\Lib\http\server.py", line 139, in server_bind
    self.server_name = socket.getfqdn(host)
  File "c:\program files (x86)\python37-32\Lib\socket.py", line 676, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 0: invalid continuation byte

在编写出色的代码之前

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,并且注意到我不小心创建了一个新的虚拟环境,所以我删除了新的Vnev文件夹,并且它已修复。

答案 1 :(得分:0)

这是Python尝试获取主机(您的计算机)名称的方法。您最近更改了吗?看来utf-8无法对其进行解码。