How do I run a python program from an internet address?

Chris Angelico rosuav at gmail.com
Mon May 7 19:51:54 EDT 2012


On Tue, May 8, 2012 at 9:20 AM, Albert <albertsun05 at gmail.com> wrote:
> I have a small text based python program that I want to make available
> to people who might be behind a firewall or can't install python on
> their office computers, but can access the internet.  It is just an
> algorithm that makes a handful of straightforward calculations on some
> input that the user provides and spits out some text as output that
> they might want to print out on a printer.  I can program python on my
> local machine, but don't know how to make the code accessible from a
> browser.

Probably the easiest way is to make your program into a web server itself:

http://docs.python.org/py3k/library/http.server.html

Put it on a high port (eg 8000) and then direct people to
http://your.machine.ip.address:8000/ to access it.

There are other ways, too, such as CGI scripting, but the http.server
module is pretty convenient.

ChrisA



More information about the Python-list mailing list