A WSGI server has to be able to convert a URL to a path on a drive, find the application named application
within the file specified and call it, passing the application a dictionary of environmental variables and a start_response function to set the status of the application and send the HTTP headers.
Note:
As we have seen the object named application
may not be an application at all, it may in fact be a chain of middleware components and an application, but the WSGI server treats it in the same way because, as we have already seen, applications with middleware stacks behave in exactly the same way as an application on its own.
The Python Web Modules come with just such a WSGI server named WSGIServer.py and available in the scripts directory of the Web Modules distribution.
To use the WSGI server simply run the WSGIServer.py file from the command line by executing the following:
> python WSGIServer.py
A sample WSGI application should be available by http://localhost:8000/doc/src/lib/wsgi-simple.py with a web browser.
WSGIServer.py also takes a series of arguments to customise its behaviour. These can be viewed by running python WSGIServer.py -h
at the command line.