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, together with a simple environment, 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
print "Serving..."
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 applications to be properly integrated into those environments. A summary of the requirements of each environment can be found in "Writing Adapters".

The Deployment Process