[WSGI] Tell Python to listen to LAN interface?

G

Gilles

Hello

I'm following this tutorial to learn about writing Python apps in
WSGI:

http://webpython.codepoint.net/wsgi_tutorial

On a Linux host with Python 2.6.6 installed, I launched the
"Environment dictionary" sample, but can't connect to it from my
remote Windows host since the application only accepts local queries:

# netstat -tunlp
....
tcp 0 0 127.0.0.1:8051 0.0.0.0:* LISTEN
13110/python

How can I tell the Python interpreter to listen on 0.0.0.0 or at least
192.168.0.0/24?

Thank you.
 
C

Chris Angelico

Hello

I'm following this tutorial to learn about writing Python apps in
WSGI:

http://webpython.codepoint.net/wsgi_tutorial

I'm guessing you're using the initialization code from here?

http://webpython.codepoint.net/wsgi_environment_dictionary

According to the docstring, the first argument to make_server() is the
host name to bind to. Using "localhost" means you're bound to
127.0.0.1, as you see. Use your LAN IP address there, or "" to bind to
all local addresses - or possibly "::" to bind to all IPv6 addresses
(try it and see - some systems work with one or the other, others work
happily with both together).

ChrisA
 
G

Gilles

According to the docstring, the first argument to make_server() is the
host name to bind to. Using "localhost" means you're bound to
127.0.0.1, as you see. Use your LAN IP address there, or "" to bind to
all local addresses - or possibly "::" to bind to all IPv6 addresses
(try it and see - some systems work with one or the other, others work
happily with both together).

Thanks Chris. I was thinking it was due to how Python was configured,
and didn't first check that it could be some instruction in the script
itself. It works fine now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top