Django 0.0.0.0:80;无法远程访问 [英] Django 0.0.0.0:80; can't access remotely
问题描述
我正在尝试从同一网络上的另一台计算机访问我的Django服务器。我设置了我的服务器,并可以使用 python manage.py runserver
正确查看所有内容,并转到 http://127.0.0.1:8000
,但是当我尝试使用 python manage.py runserver 0.0.0.0:80
时,我无法从另一台计算机上查看我的Django页面。托管Django服务器的计算机具有Intranet IP 192.168.1.146。在我的辅助计算机上,我启动浏览器,尝试访问 http://192.168.1.146:80
无效。我也转发了端口80(并且我也尝试了8000)也没有用(帮助!
I'm trying to access my Django server from another computer on the same network. I've set up my server and can view everything correctly usingpython manage.py runserver
and going to http://127.0.0.1:8000
but when I try to use python manage.py runserver 0.0.0.0:80
, I can't view my Django page from another computer. The computer hosting the Django server has intranet IP 192.168.1.146. On my secondary computer, I fire up a browser and try to access http://192.168.1.146:80
to no avail. I've also forwarded port 80 (and I've tried 8000 as well) also to no avail :(. HELP!
推荐答案
我在Windows计算机上有同样的问题,并使用 python manage.py runserver 192.168.1.146:80
而不是0.0.0.0启动Django服务器(I使用不同的IP地址当然)。
I had the same question on a Windows computer, and started the Django server with python manage.py runserver 192.168.1.146:80
, instead of the 0.0.0.0. (I used a different IP address of course).
之后,弹出一个Windows防火墙对话框,询问是否应该取消阻止端口(是)。LAN中的其他计算机然后可以使用192.168.1.146:80访问Django服务器。
After that, a Windows Firewall dialog popped up and asked if I should unblock the port (yes). Other computers in the LAN could then access the Django server using 192.168.1.146:80.
这篇关于Django 0.0.0.0:80;无法远程访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!