在局域网系统中访问Django项目 [英] Accessing django project in LAN systems
问题描述
我使用django并开发了一个运行良好的站点,该站点即将投入生产并可以在几周内部署.
因此,在投入生产之前,我想与我的一些员工共享该网站,以检查其功能以及其他内容.实际上,他们的系统是通过LAN与我的系统连接的.
所以我的系统IP地址类似于192.168.12.135
,当我们运行django开发服务器时,它的运行地址为localhost:8000
,我的意思是系统IP地址和端口8000
,例如192.168.12.135:8000
. /p>
因此,我将项目站点链接共享为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
的解决方案((在移至
生产))
您需要明确告知开发服务器在IP上而不是localhost
上运行.
尝试python manage.py runserver your_ip:port
.
如果您正在通过apache或开发服务器以外的任何其他Web服务器运行,则可以访问它.
关于第一个问题,我建议您托管和使用本地apache服务器,而不要使用开发服务器.这样一来,您可以预见到生产过程中将面临的问题.
第二,有很多可用的资源来配置带有不同服务器的Django.冰雹谷歌. :)
I used django and developed a site which is working fine, and its about to move to production and ready for deployment in a couple of weeks.
So before moving to production, i want to share the site with some of my employees to check the functionality and something else. Actually their systems are connected in LAN with mine.
So my system IP address is something like 192.168.12.135
, when we run run django development server its runs at localhost:8000
, i mean with the system IP address and with a port 8000
like 192.168.12.135:8000
right.
So i had shared them the project site link as 192.168.12.135:8000
, but when they tried on the systems which are connected in LAN, it is not accessible and displaying an error Server not found
.
I tried the above same way because recently i used python web.py
framework and developed a minimal site , and when we run the server, it by default runs as localhost:8080
, and when i accessed this link from others system that are connected in LAN with mine as 192.168.12.135:8000
, its working fine and is accessible.
So can anyone please let me know
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
(First of all i am looking for a solution for 1st problem
(Accessing in LAN before moving to
production))
You need to explicitly tell the development server to run on your IP rather than localhost
.
Try python manage.py runserver your_ip:port
.
Though it'll be accessible if you're running through apache or any other webservers other than the development server.
And to your 1st question, I would advice you to host and use a local apache server rather than using development server. Doing so, you can foresee the issues you'll be facing when moving to production.
And to 2nd, there are plenty of resources available configuring Django with different servers. Hail Google. :)
这篇关于在局域网系统中访问Django项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!