Learn how to build WSGI applications. Your client will be disappointed if you build it using just pure CGI. Here is an example WSGI app:
#!/usr/bin/python
# An example Python WSGI application
#
from wsgiref.simple_server import WSGIServer, WSGIRequestHandler
def example_app(environ, start_response):
# Environment variables are in `environ`
# `start_response` is a function for passing the status and headers
headers = []
headers.append(("Content-type", "text/html"))
start_response("200 OK", headers)
return ["This is some data. The app must return an iterable like a list."]
httpd = WSGIServer(('', 8080), WSGIRequestHandler)
httpd.set_app(example_app)
httpd.serve_forever()
The benefit of WSGI being that it doesn't need to spawn another Python process for each request like CGI does.
According to the WSGI wiki,
WSGI is the Web Server Gateway
Interface. It is a specification for
web servers and application servers to
communicate with web applications
(though it can also be used for more
than that). It is a Python standard,
described in detail in PEP 333.
For more information, consult PEP-333.