Server side newbie

John M. Gabriele john_sips_teaz at yahooz.com
Sun Jan 29 21:13:23 EST 2006


swisscheese wrote:
> I have a simple python desktop app with several edit controls and a
> couple of buttons. It just does some math. What's the simplest way to
> make it a server-side app so visitors to my site can run the app via
> their browser?
> 

The *simplest* way is to make it into a CGI script.

What you'll probably want is to make the CGI script
produce some html with a form in it. The form action
is the CGI script itself. This way, after you hit the
submit button, you get the same page back again (with
your math answer written in the page somewhere), with
the same fields and submit button waiting for you to
use the script again.

Use the cgi module to access the data that gets
submitted by the form.

To run your script, you'll need to install a web server.
On Debian it's:

     apt-get install apache2

Then you put your CGI script into /usr/lib/cgi-bin/foo.py
and point your browser to

     http://localhost/cgi-bin/foo.py

---J


-- 
(remove zeez if demunging email address)



More information about the Python-list mailing list