# HG changeset patch
# User paulb
# Date 1192319001 0
# Node ID 341a305f5d469fb57a63e2e38cf5ad10ed19ca6f
# Parent 9c2cdd3327fd6c7fbf2c80f21f18d0fd26d6263c
[project @ 2007-10-13 23:43:21 by paulb]
Added references to WSGI deploy_* functions.
diff -r 9c2cdd3327fd -r 341a305f5d46 docs/deploying-applications.html
--- a/docs/deploying-applications.html Sat Oct 13 23:43:05 2007 +0000
+++ b/docs/deploying-applications.html Sat Oct 13 23:43:21 2007 +0000
@@ -25,7 +25,13 @@
Deploy application code in the specified script directory
Restart the Web server
-
tools/JavaServlet
and
follow your servlet container's instructionsThe process of deploying a WebStack application should be as @@ -11,6 +13,7 @@ or using the deployment processes of the server environment or framework in which the application will be living.
+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
@@ -22,7 +25,9 @@
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.
The +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
@@ -33,6 +38,7 @@
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 @@ -40,6 +46,7 @@ applications to be properly integrated into those environments. A summary of the requirements of each environment can be found in "Writing Adapters".
+Depending on how "simple" the adapter code is allowed to be for a given @@ -14,46 +15,93 @@ initialises and deploys your application, or to produce a more complicated piece of code which satisfies some more demanding server requirements.
-When deploying an application,
-it is possible to use a one-shot
-deployment
-function for BaseHTTPRequestServer, CGI, Django, Java Servlet, mod_python, Twisted and WSGI configurations. The
-deploy
-function is called as follows:
deploy(resource)-
deploy(resource, authenticator) # where authenticators are used
For some frameworks, an address -may be specified:
-deploy(resource, address=(host_string, port_integer))-
deploy(resource, authenticator, address=(host_string, port_integer))
And for some frameworks, the return value of the function is important:
something = deploy(resource)
something, something_else = deploy(resource, authenticator)
Here is a summary of which + +
When deploying an application, it is possible to use a one-shot deployment
+function for BaseHTTPRequestServer, CGI, Django, Java Servlet, mod_python,
+Twisted and WSGI configurations. The deploy
function is called as
+follows:
deploy(resource) +deploy(resource, authenticator) # where authenticators are used ++ +
Note that for WSGI, the functions deploy_as_cgi
+and deploy_with_wsgiref
are provided instead, and the appropriate
+function could be imported like this:
from WebStack.Adapters.WSGI import deploy_as_cgi as deploy+ +
For some frameworks, an address may be specified:
+ +deploy(resource, address=(host_string, port_integer)) +deploy(resource, authenticator, address=(host_string, port_integer)) ++ +
And for some frameworks, the return value of the function is important:
+ +something = deploy(resource) +something, something_else = deploy(resource, authenticator) ++ +
Here is a summary of which
frameworks require address information and which produce important return values from the deploy
function:
Framework | -Address Information | Return Values | +Address Information | +Return Values |
---|---|---|---|---|
BaseHTTPRequestHandler | -Supported | + | Supported | +|
CGI | -Ignored | + | Ignored | ++ |
Django | +Ignored | +Handler function | ||
Django | Ignored | Handler function | ||
Java Servlet | Ignored | Servlet class | ||
mod_python | Ignored | Handler function and authenticator function (a 2-tuple) | ||
Java Servlet | +Ignored | +Servlet class | +||
mod_python | +Ignored | +Handler function and authenticator function (a 2-tuple) | +||
Twisted | -Supported (host_string
-is ignored) | + | Supported (host_string is ignored) |
+ |
Webware (> 0.8.1) | Ignored | URL context object | ||
Webware (> 0.8.1) | +Ignored | +URL context object | +||
WSGI | -Ignored | + | Supported for deploy_with_wsgiref + Ignored for deploy_as_cgi
+ |
+
Sometimes, when resources throw unhandled exceptions when processing requests, it is desirable to see the details of the exceptions either in the Web browser or in the console from which the application was @@ -64,23 +112,16 @@ false value, will not supress unhandled exceptions with an "internal server error" response, but will instead provide the underlying server environment's report of such exceptions.
-The remaining frameworks (Java
-Servlet,
-mod_python, Webware and
-Zope) do
-not support the deploy
-function due to the way
-applications are
-typically integrated into the various server mechanisms. In these
-cases, it
-may be worth investigating the examples provided and using their
-adapter code
-as a template for the code for your own applications. Here is a summary
-which
+
+
The remaining frameworks (Java Servlet, mod_python, Webware and Zope) do
+not support the deploy
function due to the way applications are
+typically integrated into the various server mechanisms. In these cases, it
+may be worth investigating the examples provided and using their adapter code
+as a template for the code for your own applications. Here is a summary which
indicates the server environments or frameworks which need most work:
BaseHTTPRequestHandler | Simple - see above | -Run the adapter code -directly | +Run the adapter code directly | |
CGI | Simple - see above | -Web server runs the -adapter code | +Web server runs the adapter code | |
Django | Simple - see above | The adapter prepares the handler function | ||
Django | Simple - see above | The adapter prepares the handler function | ||
Java Servlet | Simple - see above |
The adapter prepares the servlet class | @@ -118,25 +157,21 @@||
Webware | -<= 0.8.1: Must
-implement InstallInWebKit
-function+ | <= 0.8.1: Must implement InstallInWebKit function> 0.8.1: Simple - see above |
- Application must be -deployed within WebKit | +Application must be deployed within WebKit |
WSGI | Simple - see above | -Web server runs the -adapter code | +Either the adapter code is run directly (deploy_with_wsgiref )+ Or the Web server runs the adapter code ( deploy_as_cgi )
+ |
|
Zope | -Must provide lots of -Zope administative classes and functions | -Application must be -deployed within Zope | +Must provide lots of Zope administative classes and functions | +Application must be deployed within Zope |