Python Http Server
Published:Python comes with a simple http server you can use to serve a directory of files as a web server. I use it all the time to serve code coverage reports and various other static web projects that don’t come with a server. Start the server using this command:
$ python -m http.server
Serving HTTP on :: port 8000 (http://[::]:8000/) ...
Once this is running you can now access the files in the directory with your web browser (at http://localhost:8000).
Bonus: To use a different port
$ python -m http.server 3000
Serving HTTP on :: port 3000 (http://[::]:3000/) ...
Double Bonus: On older systems, or systems without python3 installed, python2 uses a
different command
$ python2 -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
$ python2 -m SimpleHTTPServer 9000
Serving HTTP on 0.0.0.0 port 9000 ...