simple web-server

P

Pavol Murin

hello python users,

could you point me to a very simple (single file is best) web-server?
I want to serve a few web-forms and run some shell scripts when the
forms are submitted. I might add Ajax later (this is not a
requirement, if it only supports forms it's OK).

Longer story:

I would like to provide a web-page for customization of an
application - it should run some shell commands as the user clicks
around in the page and at the end write a configuration file. I had a
look at the python wiki (http://wiki.python.org/moin/WebProgramming),
where various web servers and frameworks are listed. The frameworks
seem to heavy for such a simple task and BaseHTTPServer just seems to
be too light. So I took a look at the web-servers listed:
httpy had the last release 1,5 years ago, Medusa more than 5 years,
Twisted seems to be able to do a lot, so probably not the simple thing
I'm looking for. CherryPy looks promising, however it is still 89
files (including some that can be removed).

If CGIHTTPServer is a good answer, could you point me to a good
(nontrivial) example?

thank you, muro
 
L

Larry Bates

hello python users,

could you point me to a very simple (single file is best) web-server?
I want to serve a few web-forms and run some shell scripts when the
forms are submitted. I might add Ajax later (this is not a
requirement, if it only supports forms it's OK).

Longer story:

I would like to provide a web-page for customization of an
application - it should run some shell commands as the user clicks
around in the page and at the end write a configuration file. I had a
look at the python wiki (http://wiki.python.org/moin/WebProgramming),
where various web servers and frameworks are listed. The frameworks
seem to heavy for such a simple task and BaseHTTPServer just seems to
be too light. So I took a look at the web-servers listed:
httpy had the last release 1,5 years ago, Medusa more than 5 years,
Twisted seems to be able to do a lot, so probably not the simple thing
I'm looking for. CherryPy looks promising, however it is still 89
files (including some that can be removed).

If CGIHTTPServer is a good answer, could you point me to a good
(nontrivial) example?

thank you, muro

Take a look at twisted web, it fits in between.

-Larry
 
T

Thomas Guettler

Pavol said:
hello python users,

could you point me to a very simple (single file is best) web-server?
I want to serve a few web-forms and run some shell scripts when the
forms are submitted. I might add Ajax later (this is not a
requirement, if it only supports forms it's OK).

If you want to run shell scripts, you might want to search for a web server written
in a shell script....

Running shell scripts which process CGI input are very insecure. It may
be possible to write secure shell scripts, but I think it is not worth
the trouble.

Django contains a simple web server for testing. But it runs as a single
process. So if one request needs long, all other requests wait.
I don't think django is too heavy for a simple task.

You can use CGIHTTPServer and the cgi module of the standard library, too.
But it has drawbacks. One is, that CGIHTTPServer can't do a redirect. (HTTP
code 302).

I whish that there was a simple and small (not twisted) webserver written in Python which can
be used in production. But I think there is none.

Thomas

BTW, use subprocess and not os.system() if you need to call other executables.
 
B

Bernard

Did you take a look at web.py? That one looks terribly small and
efficient :)

We use CherryPy coupled with compiled Cheetah Templates for
every web server based projects at my workplace and we've been really
satisfied with it so far.
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top