我使用 django 并开发了一个运行良好的网站,它即将投入生产并准备在几周内进行部署。
因此,在投入生产之前,我想与我的一些员工共享该站点以检查功能和其他内容。实际上,他们的系统与我的系统连接在局域网中。
所以我的系统 IP 地址类似于 192.168.12.135
,当我们运行运行 django 开发服务器时它运行在 localhost:8000
,我的意思是系统 IP 地址和端口 8000
就像 192.168.12.135:8000
对。
所以我已经将项目站点链接共享给他们 192.168.12.135:8000
,但是当他们尝试在 LAN 中连接的系统上时,它无法访问并显示错误 Server not found
。
我尝试了上述相同的方式,因为最近我使用了 python web.py
框架并开发了一个最小的站点,当我们运行服务器时,它默认运行为 localhost:8080
,当我访问它时来自与我的局域网连接的其他系统的链接 192.168.12.135:8000
,它工作正常并且可以访问。
所以任何人都可以让我知道
1. How to access the site on the systems that are connected in LAN before moving to production(in some real servers like apache, nginx etc.,).
2. Basically i am new to web developing and this is my first site developed in python, so
i don't know more about servers and deploying a project. So can anyone please let me know
the detailed information about deploying django on different servers
(首先,我正在寻找解决方案 1st problem
(在进入生产之前在局域网中访问))
原文由 Shiva Krishna Bavandla 发布,翻译遵循 CC BY-SA 4.0 许可协议
您需要明确告诉开发服务器在您的 IP 而不是
localhost
上运行。尝试
python manage.py runserver your_ip:port
。如果您通过 apache 或开发服务器以外的任何其他网络服务器运行,则可以访问它。
对于您的第一个问题,我建议您托管和使用本地 Apache 服务器,而不是使用开发服务器。这样做,您可以预见在转向生产时将面临的问题。
第二,有大量资源可以使用不同的服务器配置 Django。向谷歌致敬。 :)