问题描述
尝试使用命令启动服务器时遇到问题
I am facing problem while trying to start the server using the command
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
it is working fine. i can access the application http://127.0.0.1:8000
可能是问题所在。
推荐答案
您的外部IP似乎正在使用端口8000。请查看进程是否正在运行并杀死它。
It looks like Port 8000 is in use by your external IP. Please have a look if a process is running and kill it.
您可以使用 netstat -a
。在Debian中,您可以通过 netstat -tulpn获得PID。 grep 8000
。最后一行应显示类似 1234 / python
的内容。现在,用 kill 1234
杀死它。
You can check the open ports with netstat -a
. In Debian you get the PID with netstat -tulpn | grep 8000
. The last line should display something like 1234/python
. Now kill it with kill 1234
.
或者,您可以重新启动系统;-)
Alternative you could restart your system ;-)
这篇关于Django manage.py runserver无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!