New to Django, can't get it running on the web through http://127.0.0.1:8000/

11,772 views
Skip to first unread message

Jenn Hughes

unread,
Dec 8, 2009, 10:50:08 AM12/8/09
to Django users
Hi, I'm new to django and fairly new to programming. I have django
installed (and it give no errors when imported on python). I also have
a cms made and configured. However I cannot anything to come up on the
page when I ran the server and checked http://127.0.0.1:8000/. I have
tried some other ports also.

If you could please help me out with this it would be GREATLY
appreciated. Thanks.

Jenn

Shawn Milochik

unread,
Dec 8, 2009, 10:54:03 AM12/8/09
to django...@googlegroups.com
We'll need some more information. What error messages are you getting, if anything. How do you know the CMS works at all, if it hasn't been run locally?

Have you followed the official tutorial to get a basic understanding of how Django works? If not, please do: http://docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01


Jenn Hughes

unread,
Dec 8, 2009, 11:05:24 AM12/8/09
to Django users
Error on IE:
Internet Explorer cannot display the webpage

Most likely causes:
You are not connected to the Internet.
The website is encountering problems.
There might be a typing error in the address.

Error on Firefox:
Failed to Connect
Firefox can't establish a connection to the server at
127.0.0.1:8000.

Though the site seems valid, the browser was unable to establish a
connection.

* Could the site be temporarily unavailable? Try again later.
* Are you unable to browse other sites? Check the computer's
network connection.
* Is your computer or network protected by a firewall or proxy?
Incorrect settings can interfere with Web browsing.

I used "python manage.py syncdb" on cms which went through with out
any errors. I took this to mean it was running.

I have gone through the official tutorial on the site (along with ones
on other sites and one in the book "Practical Django Projects").


This is the message I get when I run the server in the shell:
[jjhughes@silo cms]$ python manage.py runserver
Validating models...
0 errors found

Django version 1.1.1, using settings 'cms.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

I have tried several other ports by adding the port number to the end
of the command, but that did not work either.

Shawn Milochik

unread,
Dec 8, 2009, 11:10:56 AM12/8/09
to django...@googlegroups.com
If you run 'ifconfig' on the command line, you will get your IP address. Let's pretend that your IP address is 192.168.1.105. Try this:

python manage.py runserver 192.168.1.105:8000

See if you can visit http://192.168.1.105:8000 instead.

I don't know what the problem is, but maybe it's something to do with your hosts file or some firewall issues that's messing with 127.0.0.1. Thanks for providing the command-line output to manage.py, although the fact that it's not giving any errors doesn't help us here.

Shawn


Shawn Milochik

unread,
Dec 8, 2009, 11:13:37 AM12/8/09
to django...@googlegroups.com
Sorry, I should have said 'ipconfig' instead of 'ifconfig' if you're running on Windows, and you mentioned IE so I guess you are. Unless you're running your Django server on one machine and trying to access it from another, which would definitely cause the exact problem you're seeing, but running it with your actual IP address should fix.

Shawn


Jenn Hughes

unread,
Dec 8, 2009, 11:18:40 AM12/8/09
to Django users
I gave this a try and I got this error:
[jjhughes@silo cms]$ python manage.py runserver 156.56.137.131:8000
Validating models...
0 errors found

Django version 1.1.1, using settings 'cms.settings'
Development server is running at http://156.56.137.131:8000/
Quit the server with CONTROL-C.
Error: That IP address can't be assigned-to.


Could the fact that I am using a university computer make any
difference (is there a way they can keep this from being used?)

Thanks for the help!

Shawn Milochik

unread,
Dec 8, 2009, 11:24:18 AM12/8/09
to django...@googlegroups.com
I don't think they can prevent you from using it locally. The fact that I can ping the IP address you provided means that it's publicly available. This either means that your machine has its own direct connection to the Internet, or ipconfig returned multiple addresses, including the address of your router, and you chose that one to try.

It's probably the latter, because that would definitely cause the error you showed from manage.py runserver. There should be a local IP address for your machine as well. Just try the different ones ipconfig shows until manage.py runsever works with it. I supposed it's possible that a proxy server is in place in your browsers by default, although I'd expect them to ignore 127.0.0.1. But out of curiosity, please check your Firefox settings to see if any proxying is taking place.

Shawn

Tom Evans

unread,
Dec 8, 2009, 11:26:16 AM12/8/09
to django...@googlegroups.com
Is the box you are running 'python manage.py runserver' on the same
box that you are running internet explorer on?

See http://en.wikipedia.org/wiki/Localhost
http://en.wikipedia.org/wiki/IP_address

Cheers

Tom

Jenn Hughes

unread,
Dec 8, 2009, 11:38:16 AM12/8/09
to Django users
I checked and no proxy is in place. I tried the other IPs, two
wouldn't let me assign it and the third went through but gave me the
same error that I began with. How odd.

Jenn Hughes

unread,
Dec 8, 2009, 11:54:05 AM12/8/09
to Django users
I'm not sure what you mean by box.

Jenn

On Dec 8, 11:26 am, Tom Evans <tevans...@googlemail.com> wrote:
> On Tue, Dec 8, 2009 at 4:18 PM, Jenn Hughes <Jaj...@aol.com> wrote:
> > I gave this a try and I got this error:
> > [jjhughes@silo cms]$ python manage.py runserver 156.56.137.131:8000
> > Validating models...
> > 0 errors found
>
> > Django version 1.1.1, using settings 'cms.settings'
> > Development server is running athttp://156.56.137.131:8000/
> > Quit the server with CONTROL-C.
> > Error: That IP address can't be assigned-to.
>
> > Could the fact that I am using a university computer make any
> > difference (is there a way they can keep this from being used?)
>
> > Thanks for the help!
>
> > On Dec 8, 11:10 am, Shawn Milochik <sh...@milochik.com> wrote:
> >> If you run 'ifconfig' on the command line, you will get your IP address. Let's pretend that your IP address is 192.168.1.105. Try this:
>
> >> python manage.py runserver 192.168.1.105:8000
>
> >> See if you can visithttp://192.168.1.105:8000instead.
>
> >> I don't know what the problem is, but maybe it's something to do with your hosts file or some firewall issues that's messing with 127.0.0.1.  Thanks for providing the command-line output to manage.py, although the fact that it's not giving any errors doesn't help us here.
>
> >> Shawn
>
> Is the box you are running 'python manage.py runserver' on the same
> box that you are running internet explorer on?
>
> Seehttp://en.wikipedia.org/wiki/Localhost
>        http://en.wikipedia.org/wiki/IP_address
>
> Cheers
>
> Tom- Hide quoted text -
>
> - Show quoted text -

Peter Rowell

unread,
Dec 8, 2009, 12:00:48 PM12/8/09
to Django users
OK, let's do a little Networking 101.

127.0.0.1 is an unroutable address (that means you'll never see it on
the Internet) that *always* means the local host; in fact it's called
'localhost' in your 'hosts' file. For Linux this is /etc/hosts, for
Windows it's in c:/windows/system32/drivers/etc/hosts. So anything
running at 127.0.0.1 is only reachable by processes running on the
same system. The error message "Firefox can't establish a connection
to the server at 127.0.0.1:8000" means that your Django dev server is
either not running at all *or* it is not running **on the same machine
as Firefox.**

The error message "Error: That IP address can't be assigned-to." is
from Django. It's in django/core/management/commands/runserver.py,
line 84, and is returned when it gets the system error 99
(EADDRNOTAVAIL). It means that the machine you are on is not at the
address 156.56.137.131. Do you know the external address of the
machine you are on? How about the address/domain name of the machine
your django dev server is on? This is important stuff to know.

Let's say you do "python manage.py runserver 0.0.0.0:8000". This tells
the dev server to make itself available on *all possible IP addresses*
that the machine has. If you know the name/address of the machine you
should be able to get to your server now.

... Unless there's a firewall between you and the server that does
like unusual addresses, such as port 8000. Dealing with unknown
firewalls is an incredibly frustrating thing because they are sort of
like The Man Behind the Curtain -- they do stuff but you don't even
know they exist. Talk to your instructor/sysadmin.

So, one last question: You said "Could the fact that I am using a
university computer make any difference (is there a way they can keep
this from being used?) "

Short answer: yes.

The longer answer is based on the answers to a lot of questions:

1. What kind of computer are you on?

2. Are you typing at the console (ie. the keyboard is directly
connected to the computer where you are trying to run Django) or are
you logged in remotely using SSH (or Putty or something like that)? If
you're at the console then the 127.0.0.1 should have worked. By the
way, if you are on a remote machine and others are working on the same
assignment you are, you may see the error "That port is already in
use." in which case you can try 8001, or some other number above 1024.
(Below 1024 you must be the root user to open that port.)

3. Does the system you are trying to run the dev server on permit you
to have "long running processes"? Many hosting companies explicitly
prohibit this and will auto-terminate anything that runs longer than N
seconds. Ask you system administrator and/or course instructor.

Bottom line: you need to get a better understanding of where your
machine lives relative to the system you are trying to run Django on.

Good luck!

Shawn Milochik

unread,
Dec 8, 2009, 12:13:21 PM12/8/09
to django...@googlegroups.com

On Dec 8, 2009, at 11:38 AM, Jenn Hughes wrote:

> I checked and no proxy is in place. I tried the other IPs, two
> wouldn't let me assign it and the third went through but gave me the
> same error that I began with. How odd.
>

I suspect there may be some other tiny but very important problem with one of your files. Unfortunately, it's probably not something one of us can guess without more information, and you're not getting any informational error messages we can use to narrow it down. I suggest you work through the official tutorial step-by-step. That way, you should find out exactly where the problem lies. If you don't get the tutorial to work, knowing the point of failure should help a lot. If you do get it to work, then you can compare your project with the tutorial and see what's different.

You should be able to zip through enough of the tutorial in 10 or 15 minutes to get your answer.

http://docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01


Shawn


Paul Menzel

unread,
Dec 8, 2009, 12:41:51 PM12/8/09
to django...@googlegroups.com
Am Dienstag, den 08.12.2009, 08:54 -0800 schrieb Jenn Hughes:
> I'm not sure what you mean by box.

»box« in this case means computer or system.


Thanks,

Paul

signature.asc

Adam H

unread,
Apr 26, 2020, 8:23:50 AM4/26/20
to Django users
I realize this is an old post. so this is for the next person who stumbles in here looking for an answer to the same question.
I had the same problem. for me, i was missing a colon in my code. it was that simple. check for red underlines in your code
i tried runserver again, python3 manage.py runserver. and the error generated led me right to the issue. hope this helps someone.


Reply all
Reply to author
Forward
0 new messages