Django入门求助,第一次建项目404
刚学卡了几天了,求助,感谢。
D:\learn\mysite>py 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. October 13, 2019 - 14:56:57 Django version 2.1, using settings 'mysite.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 0x00000158622ED840> Traceback (most recent call last): File "D:\Python\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "D:\Python\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 "D:\Python\lib\site-packages\django\core\servers\basehttp.py", line 163, in run httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6) File "D:\Python\lib\site-packages\django\core\servers\basehttp.py", line 66, in __init__ super().__init__(*args, **kwargs) File "D:\Python\lib\socketserver.py", line 452, in __init__ self.server_bind() File "D:\Python\lib\wsgiref\simple_server.py", line 50, in server_bind HTTPServer.server_bind(self) File "D:\Python\lib\http\server.py", line 139, in server_bind self.server_name = socket.getfqdn(host) File "D:\Python\lib\socket.py", 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
不是这样,不过谢谢了
执行一下./manage.py makemigrations和./manage.py migrate 再看看
谢谢,好像还是不行
如果项目是新建的,可以把app下的makemigrations文件删掉再run makemigratons 和migrate
请问解决了吗,怎么搞的,我也卡在这了,哭了