Deploying a WebStack Application

The process of deploying a WebStack application should be as straightforward as taking some adapter or "glue" code and either running it or using the deployment processes of the server environment or framework in which the application will be living.

The Adapter Code

What adapter or "glue" code does is to set up your applications main resource object and to hook that object up with the underlying server environment. For the MyApplication example it typically looks something like this:

from WebStack.Adapters.BaseHTTPRequestHandler import deploy    # import the support for the server environment
from MyApplication import MyResource # import the main resource class
deploy(MyResource()) # connect a resource object to the server environment

In the case of BaseHTTPRequestHandler, which is a module in the Python standard library, you can just run this code, making sure that the MyApplication module or package is on your PYTHONPATH. Then, you can visit http://localhost:8080 in your browser and see the result.

More Demanding Adapter Code

Unfortunately, not all server environments can be connected up with applications this easily. Some environments require special classes and functions to be defined in the adapter code in order for the applications to be properly integrated into the environments. Here is a summary which indicates the server environments or frameworks which need most work:

Framework Adapter Code Requirements Deployment Process
BaseHTTPRequestHandler Simple - see above Run the adapter code directly
CGI Simple - see above Web server runs the adapter code
Java Servlet Must subclass HttpServlet Application must be deployed using supplied tools
mod_python Must implement handler function Web server runs the adapter code (which must be declared within Apache)
Twisted Simple - see above Run the adapter code directly
Webware <= 0.8.1: Must implement InstallInWebKit function
> 0.8.1: Simple, but must provide a urlParser object
Application must be deployed within WebKit
WSGI Simple - see above Web server runs the adapter code
Zope Must provide lots of Zope administative classes and functions Application must be deployed within Zope

The Deployment Process