使django服务器可以在LAN中访问 [英] making django server accessible in LAN

查看:95
本文介绍了使django服务器可以在LAN中访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了django服务器,它可以访问如下

I have installed django server and it can be accessible as below

http://localhost:8000/get-sms/
http://127.0.0.1:8000/get-sms/

假设我的ip是xxxx。

suppose My ip is x.x.x.x .

从另一台电脑在同一个网络下,当我做

From another PC under same network when I do

my-ip:8000 / get-sms / 它不工作。

我可以用这台电脑轻松ping我的IP。

I can easily ping my IP with that computer.

此外在我的端口81我有apache,可以像下面那样可以访问

Moreover on my port 81 i have apache, which is eaily accessible like below

http:///my-ip:81

在django中需要额外的东西

what can be the issue? Do I need something extra in django

推荐答案

运行Django开发服务器

这是您要查找的内容。为了进一步帮助你,这里是你应该做的:

python manage.py runserver 0.0.0.0:8000

顺便提一下,这可能与重复问题。

By the way, this may be a duplicate of that question.

文档说明如下:


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

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.

这篇关于使django服务器可以在LAN中访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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