问题描述
我使用了与教程相同的代码 drf website
当我跑步时
python manage.py runserver
它在终端中给了我这个
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 10,2021 - 07:12:08
Django version 3.2.5,using settings 'drftut.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Firefox 给了我这个错误:
连接超时
位于 127.0.0.1 的服务器响应时间过长。
The site Could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages,check your computer’s network connection.
If your computer or network is protected by a firewall or proxy,make sure that Firefox is permitted to access the Web.
我也在使用 wsl1 和 vscode 远程桌面来实现 wsl,并且我在 python 环境中运行它
解决方法
kill $(lsof -t -i:8000)
在终端或 cmd 中使用此命令来终止已经在 PORT 8000 上运行的进程。
如果这也不适合您,请尝试在另一个端口上运行服务器,例如 python manage.py runserver 5000
或任何其他空闲端口