一直关注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,python3.6和django2.0.2上运行
答案 0 :(得分:0)
您没有应用迁移,因此您需要运行'python manage.py migrate'。 系统会向您写信。
答案 1 :(得分:0)
上述答案虽然正确,但不是溶剂。 我正在关注django网站上的一个指南,它告诉我有关迁移的事情,我们会在后面的章节中解决这个问题。
但是我设法通过更改我的计算机名称来解决这个问题,它包含一个非utf8字符(我瑞典语并使用'ö')。