# HG changeset patch # User paulb # Date 1168129624 0 # Node ID c392bca946825fa51a6177ab2418b5e25c23836f # Parent fc930c1b31536bae2fdcfec07c22c93094439c5c [project @ 2007-01-07 00:27:04 by paulb] Removed redundant API documentation. Added notes about site maps. Added selector documentation. diff -r fc930c1b3153 -r c392bca94682 docs/deploying.html --- a/docs/deploying.html Sat Jan 06 20:30:37 2007 +0000 +++ b/docs/deploying.html Sun Jan 07 00:27:04 2007 +0000 @@ -1,11 +1,9 @@ - -
-The process of deploying a WebStack application should be as @@ -17,8 +15,7 @@
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,
+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@@ -26,20 +23,28 @@ Python standard library, you can just run this code, making sure that the
from MyApplication import MyResource # import the main resource class
print "Serving..."
deploy(MyResource()) # connect a resource object to the server environment
MyApplication
module or package is on your PYTHONPATH
.
Then, you can visit http://localhost:8080
in your
-browser and see the result.
+browser and see the result.The
+above example suggested the direct deployment of a specific resource,
+and this was quickly achieved by instantiating the resource within the
+call to the deploy
function. However, it may be more
+desirable to have an application provide a function within the module
+or package containing the resources which causes their initialisation
+in a more sophisticated fashion and which returns a resource object
+ready for use. Let us suppose that the MyApplication
module provides a function for this purpose:
from WebStack.Adapters.BaseHTTPRequestHandler import deploy # import the support for the server environment
from MyApplication import get_site_map # import the function indicating the "root" resource
print "Serving..."
deploy(get_site_map()) # connect a resource object to the server environment
Whilst
+this appears to be trading one name for another, the intent is really
+to provide a layer of abstraction which hides the details of resource
+classes from the deployment code, even if the get_site_map
function is only as simple as the following:
def get_site_map():
return MyResource()
Of course, this function may be made more complicated as the need arises.
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".
+requirements of each environment can be found in "Writing Adapters".