如何使Django的devserver公开?它很普遍吗? [英] How to make Django's devserver public ? Is it generaly possible?

查看:141
本文介绍了如何使Django的devserver公开?它很普遍吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题。我正在尝试Django框架,我会分享/介绍/展示我对我的同事/朋友做的一些事情。我在Ubuntu下通过VMware在Win7下工作。所以我的愿望是将目前的pub-IP与端口发送(例如: http://123.123.123.123 :8181 / django-app / )给我的朋友,所以他们可以测试它。



问题是 - 我使用django的Dev服务器(python /path-to-django-app/manage.py runserver $ IP:$ PORT)。



我如何让这个devserver公开?



建议?



PS抱歉不好英文



编辑:



哦,有一些我忘了提到。我很伤心,我用的是Ubuntu Ubuntu。我有一个shellscript,返回我当前的int-IP 192.168.xx.xx将它保存在环境变量($ CUR_IP)
所以,每次我想要运行django的devserver,我只需执行

  python /path-to-django-site/manage.py runserver $ CUR_IP:8080 
/ pre>

以这种方式,我成为一个http地址(例如 http://192.168.40.145:8080/app-name/ ),我可以在我的虚拟机之外使用。我可以在我的主机(win7)机器上测试。这实际上是我问这个问题的原因。我认为有一种方法可以使用ext-IP,并使runserver可用于outable。

解决方案

192.168。 *。* 是一个LAN私有地址 - 一旦完成了正确的VMWare(或其他VM管理器)和防火墙咒语,使其可以从LAN访问,它仍然无法访问从LAN外部,即从互联网上(也是一件好事,因为这样的开发服务器不是为安全性和可扩展性而设计的)。



要使具有局域网专用IP的机器的一些端口可以在互联网上看到,您需要一个具有虚拟服务器能力的路由器(许多路由器,甚至是便宜的路由器,提供它,但是不可能具体关于实现它,因为每个品牌都有自己的特殊方式)。我还建议 dyndns 或其他类似服务将稳定的DNS名称与您随时变化的公共IP(除非你从连接提供商那里获得一个静态IP,否则后一种选择会变得更加昂贵)。



superuser.com或serverfault。 com可能会提供更好的答案和细节(一旦您在一个问题中给出您的配置的每一个细节),因为该问题与软件开发无关,与服务器管理和配置有关的一切。


I've got a question. I'm currently trying out the Django framework and I would share/present/show some stuff I've made to my workmate/friends. I work in Ubuntu under Win7 via VMware. So my wish/desire is to send my current pub-IP with port (e.g http://123.123.123.123:8181/django-app/) to my friends so they could test it.

the Problem is - I use django's Dev server (python /path-to-django-app/manage.py runserver $IP:$PORT).

How do I make the devserver public ?

Suggestions?

P.S. Sorry for bad English

EDIT:

Oh, there's something i forgot to mention. As I sad I use VMware with Ubuntu. I have a shellscript that returns me my current int-IP 192.168.xx.xx an saves it in a environment-variable ($CUR_IP) So, each time I want to run django's devserver I simply execute

python /path-to-django-site/manage.py runserver $CUR_IP:8080

At this way I become an http-adress (e.g.http://192.168.40.145:8080/app-name/) which I CAN USE OUTSIDE my virtual machine. I could test it on my host (win7) machine. That's actually the reason why I asked the question. I thought there's a way to use the ext-IP and make runserver usabable outise too

解决方案

192.168.*.* is a LAN-private address -- once you've done the proper VMWare (or other VM manager) and firewall incantations to make it accessible from the LAN, it still won't be accessible from outside the LAN, i.e., from the internet at large (a good thing too, because such development servers are not designed for security and scalability).

To make some port of a machine with a LAN-private IP visible to the internet at large, you need a router with a "virtual servers" ability (many routers, even cheap ones, offer it, but it's impossible to be specific about enabling it since each brand has its own idiosyncratic way). I would also recommend dyndns or other similar service to associate a stable DNS name to your always-varying public IP (unless you're splurging for a static IP from your connectivity provider, of course, but the latter option is becoming costlier all the time).

superuser.com or serverfault.com may provide better answers and details (once you give every single little detail of your configuration in a question) since the question has nothing much to do with software development and everything to do with server administration and configuration.

这篇关于如何使Django的devserver公开?它很普遍吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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