[Tutor] Build your own web server in three lines of code

Kent Johnson kent37 at tds.net
Thu Mar 23 15:54:41 CET 2006

Ben Vinger wrote:
> The nice-looking, revamped Python web site states that
> you can do this, but does not go on to say how.  
> Does anyone know?

I don't know how to do it in three lines; how about one line? ;)

 From a command prompt
python -c "import CGIHTTPServer; CGIHTTPServer.test()"

will start a web server serving static files from the current directory 
and subdirectories and serving cgi from ./cgi-bin.


More information about the Tutor mailing list