Python Simple HTTP Server

03 September 2010

Every now and then I need to serve something over HTTP. Most of the times, it was to test out JavaScript with callbacks. It won't run by double clicking the sample HTML file, you need to serve everything.

With python simple HTTP server, all I need to do is just drop in the directory and run:

  python -m SimpleHTTPServer

Output: Serving HTTP on 0.0.0.0 port 8000 ...

It will start HTTP server on default port 8000. To use other port, just add the port number:

  python -m SimpleHTTPServer 8001

Output: Serving HTTP on 0.0.0.0 port 8001 ...

Head up to http://localhost:8001 to view it. Simple, easy, straight to the point.

« back