arzumy md short notes on small discoveries

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

  Serving HTTP on port 8000 ...

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

  python -m SimpleHTTPServer 8001

  Serving HTTP on port 8001 ...

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

arzumy md, CTO at Fave and BillPlz.