Shi*_*dla 12 python django lan
我使用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
Run Code Online (Sandbox Code Playgroud)
(首先,我正在寻找一种解决方案1st problem(在转移到生产之前在LAN中访问))
Pon*_*ech 34
如果你跑
python manage.py runserver 0.0.0.0:8000
您的开发服务器将在端口8000上提供给LAN上和localhost上的任何人(并且它不依赖于您的IP地址)
Bab*_*abu 30
您需要明确告诉开发服务器在您的IP上运行而不是localhost.
试试python manage.py runserver your_ip:port.
虽然如果您正在运行apache或除开发服务器之外的任何其他Web服务器,它将是可访问的.
对于您的第一个问题,我建议您主持和使用本地Apache服务器而不是使用开发服务器.这样做,您可以预见到生产过程中您将面临的问题.
第二,有很多资源可用于配置Django和不同的服务器.向谷歌致敬.:)