simple web-server

Thomas Guettler hv at
Fri Mar 28 15:28:03 CET 2008

Pavol Murin schrieb:
> 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.


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

>  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 (,
> 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

Thomas Guettler,
E-Mail: guettli (*) thomas-guettler + de

More information about the Python-list mailing list