Super Lightweight Static Web Server

Update 2025

Over the last couple of years, I’ve learned that Python has a folder and file http server built in. This entire process is replaced by:

python3 -m http.server

To open an http server on port 8000 serving the current cwd.

You can even override the direct, the bind address, and/or the port if needed. See python3 -m http.server --help for details.

Background

There have been a couple of times when I wanted to just quickly pull up a directory as a web site and check that I had the files laid out correctly before pushing them to the main server.

I have had to do this so often, that part of setting up a new machine for me is to install a web server IIS when on Windows, and with Apache2 or Nginx when on Linux.

However, this doesn’t usually work well for anyone trying to help me on a project temporarily.

I recently learned about the Python Flask module that can act as a droplet server with little to no configuration.

Shout out to Adam Sommer for the initial proof of concept - what I have presented below is a slightly improved version from his post.

Setup



(Download: Click Here)