1

I recently pushed a Django application into a docker container. I SSH'd into that container using docker run -it locally, and tried to run 'python manage.py runserver'. It shows the command is running

Performing system checks...

System check identified no issues (0 silenced).
kdlkjFebruary 20, 2018 - 04:54:28
Django version 1.11.6, using settings 'settings.base'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

But when I go to http://127.0.0.1:8000, it says the site can't be reached.

TJB
  • 3,706
  • 9
  • 51
  • 102

1 Answers1

2

You are running the command using ssh so it is running on the server.

But you are trying to access on your local machine. But the project is not running on the local machine and hence it is not reachable on the browser using localhost ip(127.0.0.1).

If you want to run on the server.

You need to access like:

http://server-ip:8000/
Astik Anand
  • 12,757
  • 9
  • 41
  • 51
  • Ah that makes sense. Do I also need to run it like python manage.py runserver :8000 ? – TJB Feb 20 '18 at 05:52
  • No you don't need to do that.because the server is also a system, but you don't have the browser to run locally on the server. That is the only difference. If you had the browser on the server, you may have run the same way `localhost:8000` on server browser and it would have worked. But as no browser and you are running on local system hence on local browser `server-ip` needed. – Astik Anand Feb 20 '18 at 06:01
  • @JBT, you can vote up and select the answer if it helped. Thanks. – Astik Anand Feb 20 '18 at 06:01