Sure, you can go really lean with the CGI or wsgiref
route. However, you get what you pay for, and I prefer Flask or WerkZeug for all the pain they prevent.
From wsgiref python docs:
from wsgiref.simple_server import make_server
def hello_world_app(environ, start_response):
status = '200 OK' # HTTP Status
headers = [('Content-type', 'text/plain')] # HTTP Headers
start_response(status, headers)
return ["Hello World"]
httpd = make_server('', 8000, hello_world_app)
print "Serving on port 8000..."
# Serve until process is killed
httpd.serve_forever()