|Sunday, March 14, 2004|
When I need to serve up a few files for friends or try out some CGIs, XML-RPC, etc. I generally just fire up the PythonCard webserver sample. However, I find the following single line at a command prompt to be quite appealing for an instant web server.
python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"
It works on any OS where you have Python installed and since you can cd (change directory) to the dir you want to serve files from before running the command you don't have to mess with config files or moving files before serving them up. If you alias the command or make a batch file you won't have to remember the whole line. Here's an example run on my Mac.
[solo:~/] altis% python -c "import SimpleHTTPServer;SimpleHTTPServer.test()" Serving HTTP on 0.0.0.0 port 8000 ... localhost - - [14/Mar/2004 09:27:09] "GET / HTTP/1.1" 200 - localhost - - [14/Mar/2004 09:27:28] "GET /gingerbread.py HTTP/1.1" 200 -
Note that this blog entry was revised after a discussion on Simon Brunning's blog.
10:03:59 AM comment