python SimpleHTTPServer module
This is quite possibly one of the easiest and most fun dev shortcuts I've discovered recently! One simple line can transform any file directory into a website...great for quickly testing out code or running on-the-fly demos. You just need to have python installed (of course). Works in cygwin, too.
$ cd [directory you want to serve as a website]
$ python -m SimpleHTTPServer
Once the server has started you will see:
Serving HTTP on 0.0.0.0 port 8000 ...
Now you can just navigate to localhost:8000 or 127.0.0.1:8000 in your browser and see the site. By default index.html file will be served up. If you would like to run the server on a different port:
$ cd [directory you want to serve as a website]
$ python -m SimpleHTTPServer [PORT_NUMBER: e.g., 8080]
Pretty nifty!

Leave a Reply

Your email address will not be published. Required fields are marked *