访问远程服务器上的Django应用程序的问题;手动分配IP地址不起作用

时间:2017-03-07 22:06:34

标签: django python-3.x localhost remote-server

我在远程服务器上设置了CentOS7开发环境,以便我的团队在继续构建时查看该网站。不幸的是每次我尝试运行python manage.py runserver时,都会收到服务器的默认Django IP地址(http://127.0.0.1:8000/)。当我尝试使用它访问应用程序时,页面将被路由到Yahoo搜索引擎页面(这意味着通常会发现找到IP的问题)。当我尝试手动设置IP地址(0.0.0.0:8000)时,我仍然被重新路由到YSE页面。

python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
March 07, 2017 - 15:56:45
Django version 1.10.6, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
$ python manage.py runserver 0.0.0.0:8000
Performing system checks...

System check identified no issues (0 silenced).
March 07, 2017 - 16:19:43
Django version 1.10.6, using settings 'myproject.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

该实例是使用现有的Bitbucket仓库创建的,该仓库使用我的本地计算机实例作为源。

当服务器运行时,它不会通知我任何错误或启动应用程序的问题。究竟是什么问题?还有其他人处理过这样的问题吗? 您可以提供任何帮助。

编辑:链接的主题未完全回答问题。该线程(Access Django app from other computers)解决了这个问题。通过runserver命令分配IP地址时,必须使用0.0.0.0:8000。然后在Web浏览器中,使用远程服务器的ip地址代替零:remote.server.ip.addressgoeshere:8000。

0 个答案:

没有答案