To serve static content of a directory over http, one can simply navigate to that directory and type:
python -m SimpleHTTPServer 11111
which will start a http server on port 11111.
This hack is nice because it requires zero-config: no stand-alone web server, no config files at all.
Is it possible to extend this example, or have an alternate way to achieve this goal, but also have CGI support?
The final goal is to have a quick and lazy way of serving a web site from a certain directory. The site has static content (HTML pages, images), but also a CGI script. The CGI script must work properly when accessed via browser.
Of course I could setup a virtual host in apache, allow CGI inside it etc. But that's not a zero-config approach.
You mean like
CGIHTTPServer
?