我无法从外部访问 python 开发服务器,我的机器上运行着一个非常小的 django 项目,现在我想让同一局域网中的计算机能够访问它,但是做不到。
我的机器上没有运行防火墙。有解决办法吗?
最佳答案
你是如何运行服务器的?
你试过这样的事情吗?
manage.py runserver 0.0.0.0:8080
来自 the documentation :
Note that the default IP address, 127.0.0.1, is not accessible from other machines on your network. To make your development server viewable to other machines on the network, use its own IP address (e.g. 192.168.2.1) or 0.0.0.0.
0.0.0.0
表示:绑定(bind)到这台计算机支持的所有 IP 地址。所以,作为 TheSingularity says ,然后您就可以通过输入通常以 192.168.* 开头的私有(private) IP 地址来访问您的 Django 应用程序;无法从 Internet 访问。
关于python - 从外部访问python开发服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4073977/