D:\learn\mysite>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 migrate' to apply them.
October 13, 2019 - 14:56:57
Django version 2.1, using settings 'mysite.settings'
Starting development server at
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x00000158622ED840>
Traceback (most recent call last):
  File "D:\Python\lib\site-packages\django\utils\", line 225, in wrapper
    fn(*args, **kwargs)
  File "D:\Python\lib\site-packages\django\core\management\commands\", line 139, in inner_run
    ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
  File "D:\Python\lib\site-packages\django\core\servers\", line 163, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "D:\Python\lib\site-packages\django\core\servers\", line 66, in __init__
    super().__init__(*args, **kwargs)
  File "D:\Python\lib\", line 452, in __init__
  File "D:\Python\lib\wsgiref\", line 50, in server_bind
  File "D:\Python\lib\http\", line 139, in server_bind
    self.server_name = socket.getfqdn(host)
  File "D:\Python\lib\", line 676, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 0: invalid start byte

评论 4

  • 输入这个之后,显示404对吧? http://localhost:8000/ 是不是下面这样? Page not found (404) Request Method: GET Request URL: http://localhost:8000/ Using the URLconf defined in myblog.urls, Django tried these URL patterns, in this order:

    admin/ blog/ The empty path didn't match any of these.

    You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

    解决办法: http://localhost:8000/blog

  • 如果项目是新建的,可以把app下的makemigrations文件删掉再run makemigratons 和migrate