paulb@68 | 1 | Introduction
|
paulb@68 | 2 | ------------
|
paulb@68 | 3 |
|
paulb@60 | 4 | WebStack is a package which provides a common API for Python Web applications,
|
paulb@60 | 5 | regardless of the underlying server or framework environment. It should be
|
paulb@60 | 6 | possible with WebStack to design and implement an application and to choose a
|
paulb@60 | 7 | deployment environment, without having to go back and rewrite large parts of
|
paulb@60 | 8 | that application to work in the chosen environment or in other environments
|
paulb@60 | 9 | (should the deployment requirements change after the application has been
|
paulb@60 | 10 | written).
|
paulb@60 | 11 |
|
paulb@68 | 12 | Framework Support
|
paulb@68 | 13 | -----------------
|
paulb@68 | 14 |
|
paulb@60 | 15 | Currently, BaseHTTPRequestHandler (via BaseHTTPServer in the standard library),
|
paulb@60 | 16 | mod_python, Twisted and Webware are supported. Each framework has its own set of
|
paulb@60 | 17 | strengths and weaknesses, but the idea is that deployment concerns can be
|
paulb@60 | 18 | considered separately from the implementation of application functionality.
|
paulb@63 | 19 | Consult the NOTES.txt files in each framework's subdirectory of the docs
|
paulb@63 | 20 | directory for some notes on how applications may be run in each environment.
|
paulb@60 | 21 |
|
paulb@68 | 22 | Tested Frameworks
|
paulb@68 | 23 | -----------------
|
paulb@68 | 24 |
|
paulb@68 | 25 | BaseHTTPRequestHandler Python 2.2.2
|
paulb@68 | 26 | mod_python 3.0.3
|
paulb@68 | 27 | Twisted 1.0.5
|
paulb@68 | 28 | Webware 0.8.1, CVS (2004-02-06)
|
paulb@68 | 29 |
|
paulb@68 | 30 | Future Work
|
paulb@68 | 31 | -----------
|
paulb@68 | 32 |
|
paulb@60 | 33 | Things to consider for future releases: higher-level authentication support,
|
paulb@68 | 34 | cookie handling, redirects, session interfaces, and much better documentation.
|
paulb@68 | 35 |
|
paulb@88 | 36 | Field access needs testing, especially for anything using the cgi.FieldStorage
|
paulb@88 | 37 | class - Webware and Twisted certainly need reviewing.
|
paulb@90 | 38 |
|
paulb@90 | 39 | Java Servlet API Notes
|
paulb@90 | 40 | ----------------------
|
paulb@90 | 41 |
|
paulb@90 | 42 | Trying to get WebStack working on top of the Java Servlet API was an
|
paulb@90 | 43 | unsuccessful exercise. First, I tried to use jythonc at the top of a directory
|
paulb@90 | 44 | structure consisting of WebStack, Simple and the SimpleApp.py source file, but
|
paulb@90 | 45 | jythonc insisted on making a Java source file - WebStack.java - which
|
paulb@90 | 46 | conflicts with the WebStack package. I would have expected it to make an
|
paulb@90 | 47 | __init__.java file inside the WebStack directory containing the Java source
|
paulb@90 | 48 | files.
|
paulb@90 | 49 |
|
paulb@90 | 50 | Then, I decided to make .jar files for each package before compiling
|
paulb@90 | 51 | SimpleApp.py, but this did not work particularly well. Each main.py file
|
paulb@90 | 52 | imports the appropriate package (WebStack.Adapters.JavaServlet for WebStack,
|
paulb@90 | 53 | Simple for Simple). The CLASSPATH environment variable was set to include
|
paulb@90 | 54 | servlet.jar from Apache Tomcat and, for SimpleApp.py, the previously produced
|
paulb@90 | 55 | .jar files.
|
paulb@90 | 56 |
|
paulb@90 | 57 | [In the WebStack root directory...]
|
paulb@90 | 58 | jythonc --all --jar .../WEB-INF/lib/WebStack.jar -J "-deprecation" main.py
|
paulb@90 | 59 | [In the examples/Common directory...]
|
paulb@90 | 60 | jythonc --all --jar .../WEB-INF/lib/Simple.jar -J "-deprecation" main.py
|
paulb@90 | 61 | [In the examples/JavaServlet/SimpleApp directory...]
|
paulb@90 | 62 | jythonc --all --workdir .../WEB-INF/classes -J "-deprecation" SimpleApp.py
|
paulb@90 | 63 | cp .../jython.jar .../WEB-INF/lib
|
paulb@90 | 64 |
|
paulb@90 | 65 | Somehow, the Simple package doesn't contain SimpleResource, even if the
|
paulb@90 | 66 | appropriate main.py file explicitly references it.
|