Can't access the development server

239 views
Skip to first unread message

Ben

unread,
Nov 17, 2008, 8:14:01 AM11/17/08
to Django users
Hi,

I'm completely new to python and Django, although fairly familiar with
programming and web servers in general.

I'm struggling to get Django up and running, at the moment, and I'd be
really grateful if someone could help.

I'm following this tutorial, after having successfully installed
Django:

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

I start the development server using:

python manage.py runserver

which seems to work ok:

Validating models...
0 errors found

Django version 1.1 pre-alpha SVN-9479, using settings
'prototype.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

In fact, on that server, I can telnet to the development server fine.
However, if I try to access it in my browser, nothing happens. The
access doesn't show up on the server output and the browser fails to
connect at all. I've tried starting it on different ports, with no
success. I am able to access the thing on port 3000, although at the
moment I'm not quite sure what this is... As far as I know there are
no firewalls between me and the server (it's a shared hosting server
with Site5).

I'm assuming that when I try to connect to port 8000 this will go
directly to the development server and apache settings etc should be
irrelevant? How about python settings? Is it possible that I've got
something misconfigured that would cause this behaviour?

Any more information I can provide?

Thanks in advance!

Ben

Ludwig

unread,
Nov 17, 2008, 3:57:11 PM11/17/08
to django...@googlegroups.com
I think the issue is that your server is only listening for incoming calls from the local (host) machine. The 127.0.0.1 is a kind of magic number that just means in IP-speak 'this machine'.

Try running it as 

python manage.py runserver www.yourhost.yourdomain.com:8000

(suitably replaced by your domain name of course).

This will make it listen for connections from other machines as well. 
If you are using the 8000 port number, your browser should connect to it when you type in


If the 8000 port is already taken (by some other server eg. apache running), you should get an error message. Then try with another port, e.g.

python manage.py runserver www.yourhost.yourdomain.com:8900

and type something like

into your browser.

The 3000 port number you mention is almost certainly wrong. There is nothing super magic about ports: they are just a number, but client and server need to use the same...

HTH
Ludwig

2008/11/17 Ben <cop...@gmail.com>

Karen Tracey

unread,
Nov 17, 2008, 4:16:09 PM11/17/08
to django...@googlegroups.com
On Mon, Nov 17, 2008 at 8:14 AM, Ben <cop...@gmail.com> wrote:

[snip]


I start the development server using:

python manage.py runserver

which seems to work ok:

Validating models...
0 errors found

Django version 1.1 pre-alpha SVN-9479, using settings
'prototype.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

[snip

 As far as I know there are
no firewalls between me and the server (it's a shared hosting server
with Site5).
[snip]

If you're trying to connect to the server from a machine other than the one you are running it on, you need to tell it to listen on all the machine's addresses, not just local-loopback (127.0.0.1), which is the default.  Try:

python manage.py runserver 0.0.0.0:8000

Karen

bruno desthuilliers

unread,
Nov 17, 2008, 4:17:24 PM11/17/08
to Django users
On 17 nov, 14:14, Ben <cop...@gmail.com> wrote:
> Hi,
>
> I'm completely new to python and Django, although fairly familiar with
> programming and web servers in general.
>
> I'm struggling to get Django up and running, at the moment, and I'd be
> really grateful if someone could help.
>
> I'm following this tutorial, after having successfully installed
> Django:
>
> http://docs.djangoproject.com/en/dev/intro/tutorial01
>
> I start the development server using:
>
> python manage.py runserver
>
> which seems to work ok:
>
> Validating models...
> 0 errors found
>
> Django version 1.1 pre-alpha SVN-9479, using settings
> 'prototype.settings'
> Development server is running athttp://127.0.0.1:8000/
> Quit the server with CONTROL-C.
>
> In fact, on that server, I can telnet to the development server fine.
> However, if I try to access it in my browser, nothing happens.
(snip)
> As far as I know there are
> no firewalls between me and the server (it's a shared hosting server
> with Site5).

Err... If I get you right, you're not running the dev server process
on your own machine ? If so, it looks like your familiarity with web
servers is lacking one important point: 127.0.0.1 is the loopback IP
address - IOW, it's an IP address that connect one machine *to
itself* !-).

Try starting the dev server with the real IP address for your server,
and you should be fine, ie if your server machine IP is
AAA.BBB.CCC.DDD, start the dev server with

python manage.py AAA.BBB.CCC.DDD:8000

> I'm assuming that when I try to connect to port 8000 this will go
> directly to the development server and apache settings etc should be
> irrelevant?

To make a long story short: yes. (To make it a bit longer : apache
could be configured to listen to port 8000, but then you couldn't run
any other process listening on this same port...)

Ben

unread,
Nov 18, 2008, 8:39:53 AM11/18/08
to Django users
Thanks -- that solved it!

Ben

On 17 Nov, 21:16, "Karen Tracey" <kmtra...@gmail.com> wrote:
> On Mon, Nov 17, 2008 at 8:14 AM, Ben <cop...@gmail.com> wrote:
>
> > [snip]
>
> > I start the development server using:
>
> > python manage.py runserver
>
> > which seems to work ok:
>
> > Validating models...
> > 0 errors found
>
> > Django version 1.1 pre-alpha SVN-9479, using settings
> > 'prototype.settings'
> > Development server is running athttp://127.0.0.1:8000/
Reply all
Reply to author
Forward
0 new messages