我使用django开发了一个网站,目前运行正常,即将进入生产阶段并准备在几周内部署。在进入生产之前,我想与一些员工分享该网站,以检查功能和其他问题。实际上,他们的系统与我的系统连接在同一局域网中。因此,我的系统IP地址类似于192.168.12.135,在运行django开发服务器时,它运行在localhost:8000,并且使用端口8000,例如192.168.12.135:8000。因此,我已经共享了项目站点链接作为192.168.12.135:8000,但当他们尝试在连接到我的局域网的系统上运行时,无法访问并显示错误“服务器未找到”。我以前使用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
首先,我正在寻找一个解决方案来解决
第一个问题
(在进入生产环境之前访问局域网)。
settings.py
中,你需要在ALLOWED_HOSTS
中添加主机名,如果你是使用macbook1.local:8000
访问服务器的,则需要将其添加到列表中,这样你就可以从手机或其他计算机访问它。例如:ALLOWED_HOSTS = ['macbook1.local']
(在 Django 1.10、Macbook 和 iPhone 上测试通过)。 - user65535