Juicy lil' bytes

Simple Local HTTP Server With Python

This could be the most concise way to launch a local server to view files from any directory on your box.

These Python one liners are simple and allow you to launch a local server from within any site directory on your machine. By default it serves on port 8000 but you can modify the port by adding the port number at the end of the command.

Note that the command changed in Python 3. Navigate to your site directory and run one of the following commands:

Python 2.x

Python 2.x Command
python -m SimpleHTTPServer

Python 3.x

Python 3.x Command
python -m http.server

If you use either of the default commands above, you can access your site at http://localhost:8000.


Don’t know what version of Python you have (or if it is installed)? Type python --version in your terminal and you will have the answer.