从外部访问python开发服务器 [英] Access from external to python development server

查看:115
本文介绍了从外部访问python开发服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从外部访问python开发服务器,我的机器上运行着一个很小的django项目,现在我想使同一LAN中的计算机能够访问它,但不能。 / p>

我的机器上没有运行防火墙。

解决方案

您如何运行服务器?

您是否尝试过某些方法?像这样?

  manage.py运行服务器0.0.0.0:8080 

来自文档


请注意,无法从网络上的其他计算机访问默认IP地址127.0.0.1。要使您的开发服务器对网络上的其他计算机可见,请使用其自己的IP地址(例如192.168.2.1)或0.0.0.0。


0.0.0.0 的意思是:绑定到此计算机支持的所有IP地址。因此,如 TheSingularity所述,您将随后能够通过输入通常以192.168。*开头的私有IP地址来访问Django应用;无法通过Internet访问。


I can't access externally to python development server, I have a very small django project running on my machine, and now I want to enable computers in the same LAN have access to it, but it can't do.

There is no firewall running on my machine. Is there a way around this?

解决方案

How are you running the server?
Have you tried something like this?

manage.py runserver 0.0.0.0:8080

From 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 means: bind to all IP addresses this computer supports. So, as TheSingularity says, you'll then be able to access your Django app by entering the private IP address usually beginning with 192.168.*; which is not accessible from the Internet.

这篇关于从外部访问python开发服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆