Delving into Delusion

Serving Local Webpages with Python

 July 16, 2020      Stardate: 74005.3     Tagged as: Python

This article is less of instruction and more documentation for myself since I keep forgetting the Python3 syntax. You can easily serve web pages locally using a bunch of languages and tools, but my preferred method is with Python. It has a simple server that can be quickly launched without a LAMP stack or anything crazy.

Note: this is definitely for local usage and not for production or facing the internet!

Python3 http.server help page

python -m http.server 8080

Run the above syntax in a terminal window in the folder that you want to serve. In my example above, “python” is mapped to python3 and 8080 is the port I want to serve at. Typical is 8000 but that is the port I serve my blog at for development and testing. To view the server, open a web browser and go to the address:


or whatever port you defined.

Software Versions

This is an automated list of software versions used during the writing of this article.

OS Ubuntu 20.04 LTS
python 3.7.4