13

Working my way through a Django tutorial, I have run django-admin startproject mysite. Now I cannot get the next step to work.

$ python manage.py runserver >>> $ 

where the blank line is where Ctrl-C was entered to break the loop. The >>> was the prompt I defined for the virtualenv. In other words, no output.

Most importantly, I get a connection refused error when connecting to http://127.0.0.1:8000. I do not get the the "'Welcome to Django' page, in pleasant, light-blue pastel" as described in the tutorial.

For other commands python manage.py works correctly. For example:

$ python manage.py check System check identified no issues (0 silenced). $ python manage.py shell --command 'import sys; print(sys.version)' 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] $/ python manage.py shell --command 'import django; print(django.__version__)' 1.11.2 

I am at loss for how explore further. I have tried:

  1. Using multiple browsers
  2. Varying the IP and port, including using LOCALHOST.
  3. Turning off the proxy
  4. Consulting other Stack Overflow, such as here and here
  5. Rebooting my computer
  6. Exploring Chrome's log's. Perhaps someone else can get something valueable out of these: Request Headers & Timing Diagram.

I am at loss for other steps to debug this problem.

6
  • Are you using a browser on the same computer as you are running the server? Commented Jun 8, 2017 at 20:01
  • Yes. I am using the Django development server on my local machine. Then I am using a browser on that same machine. Commented Jun 8, 2017 at 20:03
  • After entering the ip and hit enter did you see loader? and after killing the server the loader disappeared ? Commented Jun 8, 2017 at 20:17
  • Chrome displays "Connecting..." in the bottom status before failing with a connection refused error. Commented Jun 8, 2017 at 21:04
  • 1
    try to open a SimpleHTTPServer, just to debug if the problem is django or something else in your computer Commented Jun 9, 2017 at 13:34

1 Answer 1

12

If you didn't change something in the settings.py you should enter the service in

localhost:8000

Using the same machine where you are runing the server.

If you want to enter from another computer in the same network you should use

$ python manage.py runserver 0.0.0.0:8000 

And change your "allowed hosts" to the ip of your computer or to *

Sign up to request clarification or add additional context in comments.

5 Comments

The python manage.py runserver localhost:8000 does not change the behavior. No output on the command line. Connection refused with a browser.
please copy paste the lines in your prompt after run, "runserver"
I placed the lines in the body of the question.
Did you ever solve this? I'm facing a similar issue.
finally this was the crap missing, wasted couple of hours with the network policies #facepalm

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.