Tech/HowTo/Python CLI Webserver

From lathama
< Tech‎ | HowTo
Jump to navigation Jump to search

If you ever need or want to create a webserver with the files in the current directory listed then just use this little snippet.

python -m SimpleHTTPServer

It will inform you of the address it is listening at or you can set the port via

python -m SimpleHTTPServer 8080

With Python 3 you might want to use:

python3 -m http.server

The same method of setting the port with Python 3 too

python3 -m http.server 8080