0

一直在关注 Coarsera 的 Python 专业,并想我会自己尝试一些东西!在我开始之前我遇到的第一件事是:

C:\Users\kurts\Python>django-admin startproject Kurtain

C:\Users\kurts\Python>cd kurtain

C:\Users\kurts\Python\Kurtain>manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have 14 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.
February 27, 2018 - 18:59:12
Django version 2.0.2, using settings 'Kurtain.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 0x00000296A6625048>
Traceback (most recent call last):
  File "C:\Users\kurts\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\kurts\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 143, in inner_run
    ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
  File "C:\Users\kurts\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 163, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\Users\kurts\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 66, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Users\kurts\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 453, in __init__
    self.server_bind()
  File "C:\Users\kurts\AppData\Local\Programs\Python\Python36\lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "C:\Users\kurts\AppData\Local\Programs\Python\Python36\lib\http\server.py", line 138, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Users\kurts\AppData\Local\Programs\Python\Python36\lib\socket.py", line 673, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 1: invalid start byte

从这里阅读其他问题,我发现安装的文件中缺少一些东西......?但即使在重新安装 django 之后,它也是同样的错误!

我在 windows10、p​​ython3.6 和 django2.0.2 上运行

4

2 回答 2

0

您没有应用迁移,因此您需要运行“python manage.py migrate”。系统写信给你。

于 2018-05-21T10:26:54.297 回答
0

上述答案虽然正确,但不是解决方案。我正在关注 django 网站上的指南,它告诉我有关迁移的信息,我们将在后面的章节中处理它。

但是我设法通过更改我的计算机名称来解决这个问题,它包含一个非 utf8 字符(我是瑞典语并且使用的是 'ö')。

于 2018-05-22T16:40:40.923 回答