尝试使用命令
启动服务器时遇到问题python manage.py runserver 0.0.0.0:8000
显示
C:\abc>python manage.py runserver 0.0.0.0:8000
Validating models...
0 errors found
Django version 1.4.9, using settings 'abc.settings'
Development server is running at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
但无法通过http://127.0.0.1:8000
显示:
Unable to connect
Firefox can't establish a connection to the server at 127.0.0.1:8000.
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.
但是当我尝试同样的时候
python manage.py runserver
工作正常。我可以访问应用程序http://127.0.0.1:8000
可能是什么问题。
答案 0 :(得分:4)
您的外部IP似乎正在使用端口8000。请查看进程是否正在运行并将其终止。
您可以使用netstat -a
检查打开的端口。在Debian中,您获得了netstat -tulpn | grep 8000
的PID。最后一行应显示1234/python
之类的内容。现在用kill 1234
杀死它。
替代方案,您可以重新启动系统; - )
答案 1 :(得分:-1)
您应该激活虚拟环境(venv \ scripts \ activate)并将dir更改为您的项目,然后尝试... ALL THE BEST