Saturday, November 30, 2013

Run simple http server on Raspberry Pi with Python

With Python pre-installed on Raspberry Pi, it's really easy to start a simple http server by enter the command:
python -m SimpleHTTPServer

Your http server will be started in port 8000 by default. Then you can visit your server by enter <Raspberry Pi IP>:port in your browser.


If you have a index.html in your current directory, it will be opened as web page. Otherwise, the files in the current directory will be listed in browser.



If you want to specify the port (8080 as example), enter the command:
python -m SimpleHTTPServer 8080





No comments: