easy n00b question

2 views
Skip to first unread message

Dr Mephesto

unread,
Sep 4, 2007, 9:36:33 AM9/4/07
to cherrypy-users
Hi,
I have been working on app in cherrypy, and it looks great on
http://localhost:8080/

So, why can't I see it from other machines on my network when I use my
development machine's IP address?

I've spent about an hour looking though the documentation, must I must
be blanking the info out, like the salt shaker thats right in front of
you... :)

Thanks,
David

Arnar Birgisson

unread,
Sep 4, 2007, 10:25:19 AM9/4/07
to cherryp...@googlegroups.com
On 9/4/07, Dr Mephesto <dnh...@googlemail.com> wrote:
> I have been working on app in cherrypy, and it looks great on
> http://localhost:8080/
>
> So, why can't I see it from other machines on my network when I use my
> development machine's IP address?

If you use the provided tutorial then by default it listens on
localhost, 127.0.0.1 - which is only accessible from itself. To get to
it from other computer you must make it listen either on your public
interface or all interfaces.

You change the listen inteface by setting the "server.socket_host" to
the IP of your interface. To listen on all interfaces use the ip
"0.0.0.0" (I think).

> I've spent about an hour looking though the documentation, must I must
> be blanking the info out, like the salt shaker thats right in front of
> you... :)

Totally not your fault, I wen't through the exact same problems when I
started with CP. This is exactly the problem I feel cp's docs have,
information like this is hard to find if you don't know where to look
and it's not mentioned in the tutorial (or linked to for that matter).
Unfortunately I don't have the time to fix it myself.. :-(

hth,
Arnar

Christian Wyglendowski

unread,
Sep 4, 2007, 10:27:52 AM9/4/07
to cherryp...@googlegroups.com
On 9/4/07, Dr Mephesto <dnh...@googlemail.com> wrote:
>
> Hi,
> I have been working on app in cherrypy, and it looks great on
> http://localhost:8080/
>
> So, why can't I see it from other machines on my network when I use my
> development machine's IP address?

What version of CherryPy? You might have to set the
server.socket_host configuration entry to your computer's IP address.
Or perhaps you have a firewall turned on?

Christian
http://www.dowski.com

Dr Mephesto

unread,
Sep 4, 2007, 10:48:28 AM9/4/07
to cherrypy-users


I'm using the latest version of everything, but I am beginning to
think its a setup issue with my version of OSX. I just noticed I cant
seem to access the in-built apache server using my IP either... I will
give it all a go on my windows box this week some time, but thanks for
help Arnar and Christian!

Robert Brewer

unread,
Sep 4, 2007, 6:52:02 PM9/4/07
to cherryp...@googlegroups.com

Information like what? That "0.0.0.0" == INADDR_ANY? Or do
you mean how/where to set server.socket_host? Or do you
mean the page that says, "what to do if CP works on your
local host but not across a network?" That last one could
take a couple weeks to write and another one to read. ;)


Robert Brewer
fuma...@aminus.org

Arnar Birgisson

unread,
Sep 4, 2007, 7:08:45 PM9/4/07
to cherryp...@googlegroups.com
On 9/4/07, Robert Brewer <fuma...@aminus.org> wrote:
> Information like what? That "0.0.0.0" == INADDR_ANY? Or do
> you mean how/where to set server.socket_host? Or do you
> mean the page that says, "what to do if CP works on your
> local host but not across a network?" That last one could
> take a couple weeks to write and another one to read. ;)

"How do I make CP listen on a different interface?"

To be fair, the CP docs have gone a long way since I was starting, but
I still have a hard time finding "server.socket_host" in times when I
don't remember it. For new people who don't even have leaky memory -
it's hard to find.

For starters I'd like the tutorial to contain more links to the
detailed documentation on any point.

Arnar

Alex Le Dain

unread,
Sep 4, 2007, 8:54:57 PM9/4/07
to cherryp...@googlegroups.com
Dr Mephesto wrote:

>> Totally not your fault, I wen't through the exact same problems when I
>> started with CP. This is exactly the problem I feel cp's docs have,
>> information like this is hard to find if you don't know where to look
>> and it's not mentioned in the tutorial (or linked to for that matter).
>> Unfortunately I don't have the time to fix it myself.. :-(

I found that you need to set the ip address of the machine in the
configuration. Unlike 2.1, where you could set 127.0.0.1 as the ip
address in CP and you could access it externally using the machine's ip
address, in 3.0.2 you need to set the ip address of the machine in the
global configuration. This opens up CP to external access (don't ask me
why, but at a guess it's security related).

ip_address = socket.gethostbyname(socket.gethostname())
global_conf = {'server.socket_host' : ip_address}
...etc

--
Alexander C. Le Dain, PhD
Software Engineer

Eugene Van den Bulke

unread,
Sep 5, 2007, 1:39:52 AM9/5/07
to cherryp...@googlegroups.com
On 9/5/07, Alex Le Dain <al...@psi.com.au> wrote:
> in 3.0.2 you need to set the ip address of the machine in the
> global configuration. This opens up CP to external access (don't ask me
> why, but at a guess it's security related).
>
> ip_address = socket.gethostbyname(socket.gethostname())
> global_conf = {'server.socket_host' : ip_address}

I am not a CP expert but I have a small app running on a server that
works for "outside" traffic without any special setup using CP 3.0.2
on windows. All I had to do is open up the port on which it is
listening in the firewall.

EuGeNe -- http://www.3kwa.com

jeffcodefork

unread,
Sep 8, 2007, 4:45:08 AM9/8/07
to cherrypy-users

I had this exact problem too where a stock 2.1 worked for me, but 3.0
didn't. On my Mac, this was due to IP6 being enabled and cherrypy
binding to an IP6 socket. That's why specifying an IP4 address makes
it work. I created a ticket here: http://www.cherrypy.org/ticket/711

I agree with the ticket responders that it's not a bug; but I still
think an info msg at startup would be helpful when getaddrinfo()
resolves to more than one address. A lot of people don't know the
consequences of having IP6 enabled (which it is by default on Mac OS).
True, that's the users' responsibility, but why make experimenting
with CherryPy that much harder when a simple change could help them
debug the issue? It's easy to get frustrated when the tutorial samples
won't work out of the box, and hurts the chances of the project
getting a wider audience.

So I also agree that better docs in general would be really helpful.
(Maybe if I get some time I will volunteer myself soon, though I'm
very much a n00b...) I write this msg because I think CherryPy is
pretty awesome, I use it and like it a lot, so I want to see it used a
lot more.

Jeff

Robert Brewer

unread,
Sep 8, 2007, 2:18:37 PM9/8/07
to cherryp...@googlegroups.com
jeffcodefork wrote:
> I had this exact problem too where a stock 2.1 worked
> for me, but 3.0 didn't. On my Mac, this was due to IP6
> being enabled and cherrypy binding to an IP6 socket.
> That's why specifying an IP4 address makes it work. I
> created a ticket here: http://www.cherrypy.org/ticket/711
>
> I agree with the ticket responders that it's not a bug;
> but I still think an info msg at startup would be helpful

Makes sense. I just added a warning about 'localhost' to the
CherryPy checker.


Robert Brewer
fuma...@aminus.org

winmail.dat
Reply all
Reply to author
Forward
0 new messages