尝试为Django 2.1项目运行服务器时出现UnicodeDecodeError

时间:2018-12-25 11:55:19

标签: python django server pipenv

我是使用Django的新手,我只是在这里运行我的第一个项目。我正在使用pipenv虚拟环境,我所做的是:创建了一个新目录,在其中安装了Django 2.1,打开了pipenv shell并执行了以下代码:

$ django-admin startproject test_project .

我接下来要做的是尝试使用以下命令运行服务器,但会引发异常。

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

System check identified no issues (0 silenced).

You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
December 25, 2018 - 12:43:58
Django version 2.1, using settings 'test_project.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 0x000001C80D5FB378>
Traceback (most recent call last):
  File "C:\Users\Pol\.virtualenvs\Django-93jgfkzB\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\Pol\.virtualenvs\Django-93jgfkzB\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:\Users\Pol\.virtualenvs\Django-93jgfkzB\lib\site-packages\django\core\servers\basehttp.py", line 163, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\Users\Pol\.virtualenvs\Django-93jgfkzB\lib\site-packages\django\core\servers\basehttp.py", line 66, in __init__
    super().__init__(*args, **kwargs)
  File "c:\users\pol\appdata\local\programs\python\python37\Lib\socketserver.py", line 449, in __init__
    self.server_bind()
  File "c:\users\pol\appdata\local\programs\python\python37\Lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "c:\users\pol\appdata\local\programs\python\python37\Lib\http\server.py", line 139, in server_bind
    self.server_name = socket.getfqdn(host)
  File "c:\users\pol\appdata\local\programs\python\python37\Lib\socket.py", line 676, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 6: invalid continuation byte

问题是,我不太了解发生了什么,而且没有用,所以如果有人可以帮助我,那真是太棒了。

谢谢

0 个答案:

没有答案