bind HTTServer to local ip:port so that others in LAN can see it?

try this:

addr = ("0.0.0.0", 8765)

Here is what i did:

import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler

addr = ("0.0.0.0", 8765)

serv = BaseHTTPServer.HTTPServer(addr, SimpleHTTPRequestHandler)

serv.serve_forever()

And got from an other machine:

192.168.1.2 - - [09/Nov/2010 22:26:09] "GET / HTTP/1.1" 200 -

even simpler:

cd to dir you want to serve and run in terminal

python -m http.server 8888 --bind 0.0.0.0

then on another box on your lan enter

192.168.x.x:8888

in the browser where 192.168.x.x is the address of the serving box on your lan, which you will see in ifconfig output


You can bind to all interfaces if you leave address as an empty string

addr = ("", 8765)

If you really want to bind to only one of your interfaces, first make sure you are entering address of the local interface, not address of some NAT device between you and your box.