2005-12-13-2238Z


Ever written an HTTP server? Doesn't get much easier than in Python:

$ cat ~/bin/httpserve
#!/usr/pkg/bin/python
import sys, SimpleHTTPServer
sys.argv.append('80')
SimpleHTTPServer.test()
This assumes the script is called with no arguments; it sets the port to 80 rather than 8000 which is the default for SimpleHTTPServer. Just cd to the directory you want to serve and type httpserve, and Python does the rest.

Back to blog or home page

last updated 2013-01-10 20:43:54. served from tektonic.jcomeau.com