Trying to connect Django dev server from remote

I have deployed my django application in server or machine A. I want to access my web page from machine B. My machine B runs in a virtual box and I did a ssh to machine A. I started the django development server at machine A using the command: python manage.py runserver 0.0.0.0:8000 I go to machine B try to access my webpage using: http://ip-machine-A:8000/appname/login/ However,I'm unable to connect. I have been through similar questions and I have tried all the solutions like modifying allowed_hosts in settings.py to ['*']. I also tried to ping the machine A and I got the response. And I also checked if the port is open by issuing the following command and it worked too. netstat -anp | grep 8000 Is there anything else I should work on to make this work? Or is this issue associated with Django development server.


I added this line

allowed_hosts=['MY_SERVER_IP']

in the file

/lib64/python2.7/site-packages/django/http/request.py

and when I did

python manage.py runserver 0.0.0.0:8000

it worked.

链接地址: http://www.djcxy.com/p/33768.html

上一篇: 在Django Rest Framework中从令牌获取经过身份验证的用户

下一篇: 尝试从远程连接Django dev服务器