February 1, 2012

Serve static files locally with python

This is just a self reference and of course can't be used in production code. But if you're willing to test something static real quick and want to avoid file:// protocol you can setup a convenient webserver with python.

Just find the root you want to serve and use:

python -m SimpleHTTPServer

Now just point your browser to localhost:8000.

Bye bye local apache.