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

2012-05-09 Thread Paul Rubin
Albert albertsu...@gmail.com writes:
 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.  

What kind of people?  I.e. is it something you're doing for work, where
the users are (say) your co-workers?  

If you're just asking the simplest way to put a python script on a web
page, I'd say it's to write a cgi and put it behind a normal web server.

I'd avoid stuff like Google app server if possible, especially if there
are any privacy concerns about the data going into the program.  I much
prefer to use cheap virtual servers even though I have to pay for them.
They are amazingly affordable: you can get a 128MB server with enough
resources for typical personal websites for a couple USD a month.  That
approach does require you to know a little bit about server
administration but it's not that big a deal.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2012-05-08 Thread james hedley

 What would be the best way to figure out how to do this?  I looked at
 Google app engine tutorial, but can't figure out how that will help we
 get the code into the cloud so I can access it from any browser.

GAE is quite a good option, since it includes free hosting. You should be able 
to get started just by downloading the SDK and making your app work locally. It 
includes a little development server so you can see what your users will see in 
your own browser. In this way, you don't have to do anything with the web until 
everything is ready, then you just press a button (windows) or run a script 
(nix) and yor app appears on the web. The datastore is quite complicated though!

If you rig up your own host though, you have a lot more freedom with what 
software you get to use. A very simple way is to plug mod_wsgi into apache (a 
common web server) and then write your app as a wsgi script; this usually just 
entails adding a couple of necessary methods to your script. In my case, I have 
a buddy with a web host set up so I can get things up on there very easily and 
for free.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2012-05-08 Thread alex23
On May 8, 9:20 am, Albert albertsu...@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.

You could do this quite easily with CherryPy:


import cherrypy

class WebApp(object):
def calc(self, a, b):
c = int(a) + int(b)
return str(c)
calc.exposed = True

cherrypy.quickstart(WebApp())

This can be called via '/calc/1/2' or 'calc?a=1b=2'. You can add a
method to provide a form and another to produce a pretty output and
it's good to go.

http://www.cherrypy.org/
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2012-05-07 Thread Albert
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.

What would be the best way to figure out how to do this?  I looked at
Google app engine tutorial, but can't figure out how that will help we
get the code into the cloud so I can access it from any browser.
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2012-05-07 Thread Chris Angelico
On Tue, May 8, 2012 at 9:20 AM, Albert albertsu...@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
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2012-05-07 Thread Steven D'Aprano
On Mon, 07 May 2012 16:20:35 -0700, Albert 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.
 
 What would be the best way to figure out how to do this?

Try googling python web app how to. For example, the very first link 
found here:

https://duckduckgo.com/html/?q=python%20web%20app%20how%20to

is an introduction to making Python applications available to run over 
the Internet.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list