paulb@348 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
paulb@328 | 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
paulb@328 | 3 | <head> |
paulb@328 | 4 | <title>Deploying a WebStack Application</title> |
paulb@348 | 5 | <meta name="generator" |
paulb@348 | 6 | content="amaya 8.1a, see http://www.w3.org/Amaya/" /> |
paulb@328 | 7 | <link href="styles.css" rel="stylesheet" type="text/css" /> |
paulb@328 | 8 | </head> |
paulb@328 | 9 | <body> |
paulb@330 | 10 | <h1>Deploying a WebStack Application</h1> |
paulb@330 | 11 | <p>The process of deploying a WebStack application should be as |
paulb@348 | 12 | straightforward as taking some adapter or "glue" code and either |
paulb@348 | 13 | running it |
paulb@348 | 14 | or using the deployment processes of the server environment or |
paulb@348 | 15 | framework in |
paulb@330 | 16 | which the application will be living.</p> |
paulb@330 | 17 | <h2>The Adapter Code</h2> |
paulb@330 | 18 | <p>What adapter or "glue" code does is to set up your applications main |
paulb@330 | 19 | resource object and to hook that object up with the underlying server |
paulb@348 | 20 | environment. For the <code>MyApplication</code> <a |
paulb@348 | 21 | href="resources.html">example</a> it typically looks something like |
paulb@348 | 22 | this:</p> |
paulb@348 | 23 | <pre>from WebStack.Adapters.BaseHTTPRequestHandler import deploy # import the support for the server environment<br />from MyApplication import MyResource # import the main resource class<br />deploy(MyResource()) # connect a resource object to the server environment</pre> |
paulb@348 | 24 | <p>In the case of BaseHTTPRequestHandler, which is a module in the |
paulb@348 | 25 | Python standard library, you can just run this code, making sure that |
paulb@348 | 26 | the <code>MyApplication</code> module or package is on your <code>PYTHONPATH</code>. |
paulb@348 | 27 | Then, you can visit <code>http://localhost:8080</code> in your |
paulb@348 | 28 | browser and see the result.</p> |
paulb@348 | 29 | <h2>More Demanding Adapter Code</h2> |
paulb@330 | 30 | <p>Unfortunately, not all server environments can be connected up with |
paulb@330 | 31 | applications this easily. Some environments require special classes and |
paulb@348 | 32 | functions to be defined in the adapter code in order for the |
paulb@348 | 33 | applications to |
paulb@330 | 34 | be properly integrated into the environments. Here is a summary which |
paulb@330 | 35 | indicates the server environments or frameworks which need most work:</p> |
paulb@348 | 36 | <table border="1" cellpadding="5" cellspacing="0"> |
paulb@328 | 37 | <tbody> |
paulb@328 | 38 | <tr> |
paulb@328 | 39 | <th>Framework</th> |
paulb@330 | 40 | <th>Adapter Code Requirements</th> |
paulb@330 | 41 | <th>Deployment Process</th> |
paulb@328 | 42 | </tr> |
paulb@328 | 43 | <tr> |
paulb@328 | 44 | <td>BaseHTTPRequestHandler</td> |
paulb@330 | 45 | <td>Simple - see above</td> |
paulb@330 | 46 | <td>Run the adapter code directly</td> |
paulb@328 | 47 | </tr> |
paulb@328 | 48 | <tr> |
paulb@328 | 49 | <td>CGI</td> |
paulb@330 | 50 | <td>Simple - see above</td> |
paulb@330 | 51 | <td>Web server runs the adapter code</td> |
paulb@330 | 52 | </tr> |
paulb@330 | 53 | <tr> |
paulb@330 | 54 | <td>Java Servlet</td> |
paulb@330 | 55 | <td>Must subclass <code>HttpServlet</code></td> |
paulb@330 | 56 | <td>Application must be deployed using supplied tools</td> |
paulb@330 | 57 | </tr> |
paulb@330 | 58 | <tr> |
paulb@330 | 59 | <td>mod_python</td> |
paulb@330 | 60 | <td>Must implement <code>handler</code> function</td> |
paulb@348 | 61 | <td>Web server runs the adapter code (which must be declared |
paulb@348 | 62 | within Apache)</td> |
paulb@328 | 63 | </tr> |
paulb@328 | 64 | <tr> |
paulb@328 | 65 | <td>Twisted</td> |
paulb@330 | 66 | <td>Simple - see above</td> |
paulb@330 | 67 | <td>Run the adapter code directly</td> |
paulb@330 | 68 | </tr> |
paulb@330 | 69 | <tr> |
paulb@330 | 70 | <td>Webware</td> |
paulb@330 | 71 | <td><= 0.8.1: Must implement <code>InstallInWebKit</code> |
paulb@348 | 72 | function<br /> |
paulb@348 | 73 | > 0.8.1: Simple, but must provide a <code>urlParser</code> object</td> |
paulb@330 | 74 | <td>Application must be deployed within WebKit</td> |
paulb@328 | 75 | </tr> |
paulb@328 | 76 | <tr> |
paulb@328 | 77 | <td>WSGI</td> |
paulb@330 | 78 | <td>Simple - see above</td> |
paulb@330 | 79 | <td>Web server runs the adapter code</td> |
paulb@330 | 80 | </tr> |
paulb@330 | 81 | <tr> |
paulb@330 | 82 | <td>Zope</td> |
paulb@330 | 83 | <td>Must provide lots of Zope administative classes and functions</td> |
paulb@330 | 84 | <td>Application must be deployed within Zope</td> |
paulb@328 | 85 | </tr> |
paulb@328 | 86 | </tbody> |
paulb@328 | 87 | </table> |
paulb@330 | 88 | <h2>The Deployment Process</h2> |
paulb@330 | 89 | <ul> |
paulb@330 | 90 | <li><a href="writing-adapters.html">Writing Adapters</a></li> |
paulb@331 | 91 | <li><a href="pythonpath.html">Getting PYTHONPATH Right</a></li> |
paulb@330 | 92 | <li><a href="deploying-applications.html">Deploying an Application</a></li> |
paulb@330 | 93 | </ul> |
paulb@328 | 94 | </body> |
paulb@328 | 95 | </html> |