In all of the previous sections you will note that all of the programs used the Request class from the albatross.cgiapp module to deploy the application as a CGI script.
The choice of Request class determines how you wish to deploy your application. Albatross supplies a number of pre-built Request implementations suited to various deployment methods. You should import the Request method from the appropriate module:
Deployment Method | Request Module |
---|---|
CGI | albatross.cgiapp |
mod_python | albatross.apacheapp |
FastCGI_python | albatross.fcgiapp |
Stand-alone Python HTTP server | albatross.httpdapp |
By placing all deployment dependencies in a Request class you are able to change deployment method with only minimal changes to your application mainline code. You could, for instance, carry out your initial development as a stand-alone Python HTTP server, where debugging is easier, and final deployment as FastCGI.
You could also develop your own Request class to deploy an Albatross application in other ways, such as using the Medusa web server (http://www.amk.ca/python/code/medusa.html), or to provide a Request class which for performing unit tests on your application.
The chapter on mod_python contains an example where the popview application is changed from CGI to mod_python.