Python Tricks #29 - Python's built-in HTTP server

Words
7
Reading
1 min
7y
Listen to this post
~1 min

Serve current folder by simply running python command.

# Python has a HTTP server built into the
# standard library. This is super handy for
# previewing websites.

# Python 3.x
$ python3 -m http.server

# Python 2.x
$ python -m SimpleHTTPServer 8000

# (This will serve the current directory at
#  http://localhost:8000)