# HG changeset patch # User paulb # Date 1113949966 0 # Node ID 6947214e9dd404c321ef77e13607e947d8647662 # Parent 7b8005a9072a9df6d92e6851fa35b358318e8b24 [project @ 2005-04-19 22:32:46 by paulb] Improved the anatomy layout. Renamed simple-example.html to resources.html and made it more concrete, together with the deployment documentation. diff -r 7b8005a9072a -r 6947214e9dd4 docs/anatomy.html --- a/docs/anatomy.html Mon Apr 18 22:47:28 2005 +0000 +++ b/docs/anatomy.html Tue Apr 19 22:32:46 2005 +0000 @@ -1,6 +1,7 @@ + Anatomy of a WebStack Application @@ -16,46 +17,59 @@ which it must respond by writing out messages to send back - specifically HTTP responses. When using WebStack, we think of the situation in terms of the following components:

- +
- + + + + + style="text-align: center; vertical-align: middle; background-color: rgb(193, 255, 102); border-top-style: solid; border-left-style: solid; border-right-style: solid; border-top-width: 1px; border-left-width: 1px; border-right-width: 1px;">Application + + + + + style="border-width: 1px; text-align: center; vertical-align: middle; background-color: rgb(102, 203, 255); border-left-style: solid; border-right-style: solid; border-top-style: solid;">Adapter + + + + + + + + + +
Application - - -The application is described in this part of the documentation. What +it doesHow much workWhere +to look
Adapter - - -Adapters are explained in the deployment -documentation. This +defines what the user sees. + Most new code will be +written in the application.The application is +described in + this part of the documentation.
Server -environment - -Server environments are covered in the deployment -documentation. This +"glues" the application to the environment.Mostly copying an existing +adapter or writing a short module.Adapters are explained in +the deployment +documentation. +
Server +environment This +is where the application runs.Some configuration needed, +if any at all.Server environments are +covered +in the deployment +documentation. +
-

To get an application up and -running, this is what you have to do:

-
    -
  1. Write some application code -which uses the WebStack API.
  2. -
  3. Write some simple adapter -code - this code "glues" the application to the environment that you -want to use.
  4. -
-

In this part of the -documentation, we will ignore the second -activity (it is covered in "Deploying a -WebStack -Application") and concentrate on the more important task of -defining an application's functionality with "A Very Simple Example".

diff -r 7b8005a9072a -r 6947214e9dd4 docs/deploying.html --- a/docs/deploying.html Mon Apr 18 22:47:28 2005 +0000 +++ b/docs/deploying.html Tue Apr 19 22:32:46 2005 +0000 @@ -1,37 +1,39 @@ - - + Deploying a WebStack Application - + -

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 +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. It typically looks something like this:

-
from WebStack.Adapters.CGI 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
- +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 +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:

- - +
@@ -56,8 +58,8 @@ - + @@ -67,9 +69,8 @@ +function
+> 0.8.1: Simple, but must provide a urlParser object @@ -84,7 +85,6 @@
Framework
mod_python Must implement handler functionWeb server runs the adapter code (which must be declared within - Apache)Web server runs the adapter code (which must be declared +within Apache)
Twisted
Webware <= 0.8.1: Must implement InstallInWebKit - function
- > 0.8.1: Simple, but must provide a urlParser - object
Application must be deployed within WebKit
-

The Deployment Process