Basic Python Web Server
Tuesday, August 4, 2026 at 12:16 AM | 1 min read
Last modified on Tuesday, August 4, 2026 at 12:16 AM
Photo by Nicolas Picard on unsplash.com
This project is a small collection of Python3 web server implementations, built to run simple, uncomplicated applications in the browser without reaching for a full framework.
web.py uses the standard library's http.server module together with socketserver.TCPServer to serve a static index.html file — the same approach Python3 uses to replace the old Python2 SimpleHTTPServer. It handles requests synchronously, one at a time, which is enough for local development, quick file sharing on a network, or serving static assets during offline work.
async-server.py takes the same basic goal — serve a page over HTTP — and implements it with asyncio instead, using asyncio.start_server and a coroutine-based request handler. It's considerably more code than the socketserver version for the same result, which is part of the point: it shows what asyncio buys you (non-blocking, concurrent request handling) and what it costs in complexity versus the synchronous approach.
For the full breakdown, see the companion post, Creating a basic Python web server in Linux. It covers the difference between ForkingMixIn and ThreadingMixIn, and how socketserver's server classes divide responsibility with request handler classes. Finally, it provides a line-by-line look at the asyncio implementation.
