Reputation: 31548
I have just installed django with python 2.7. After creating intitial project it says to check at
http://127.0.0.1:8000/
But that is my VPS server and i can't open browser there.
i tried http://vpsIPaddress:8000
but it didn't worked
Upvotes: 6
Views: 4661
Reputation: 81
I recently faced this issue while running my server using python development server. After reading the answer, I almost was going to switch to nginx. Someone on the web I saw that your can
python manage.py runserver example.com:8000
you can also put the ip address instead of the host name. This works. I just tested it.
Upvotes: 0
Reputation: 6570
You can start your server with following command:
python manage.py runserver 0.0.0.0:12345
Then, the dev server will bind all the possible ip address on your server which is a convenient way for test :)
Upvotes: 17
Reputation: 50650
When you start your server in development mode, it is ONLY available via localhost
/127.0.0.1
. That said, if you have a port conflict, you can change the port it uses:
python manage.py runserver 12345
And then you can access the development server via:
http://127.0.0.1:12345
It's worth reiterating that the development server will NOT be available from remote hosts, to discourage you from using it in a production environment, which it is not suited for. If you need to be able to access your Django app from a remote host, you need to deploy your application to something like Apache2 with mod_wsgi.
Upvotes: 0