How to host a web server using Python ?
Hosting a web server using Python is very simple. Any default installation of Python includes a module called SimpleHTTPServer. We can make use of this module to start python and host a web server on any port as we wish. In this article we will show you how to do so.
1) Bring up a terminal and move to a directory which you want to be served.
2) Now type the following command in your terminal and hit enter
3) You are done. point your web browser to your-ip:port. The contents of the directory from which you have started the python SimpleHTTPServer will be served as the default page. To Stop the webserver, you just need to hit Ctrl-C from the keyboard.
Check out this screencast and the screenshots for further details.
Permalink for the above screencast: http://blip.tv/file/1878275
This method of hosting a website is very dynamic. You can use this method to share any directory temporarily and yes on any port you like. You can also view real time access logs on the command line itself where you have started the python web server from.