WebStack

docs/pythonpath.html

733:26865b172666
2007-11-12 paulb [project @ 2007-11-12 00:51:34 by paulb] Added a StringResource class for simple static resources. Introduced base classes for common authentication activities. Merged "app", "path" and "qs" fields into a single "app" field for login and redirection. Added support for OpenID authentication.
     1 <?xml version="1.0" encoding="iso-8859-1"?>     2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"     3        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     4 <html xmlns="http://www.w3.org/1999/xhtml">     5 <head>     6   <title>Getting PYTHONPATH Right</title>     7   <link href="styles.css" rel="stylesheet" type="text/css" />     8 </head>     9     10 <body>    11 <h1>Getting PYTHONPATH Right</h1>    12     13 <p>When deploying your application, it is essential that it has access to all    14 the necessary libraries and packages that it uses. If such libraries and    15 packages were installed using the standard <code>setup.py</code> program,    16 then you may only need to worry about the application itself being found by    17 Python.</p>    18     19 <h2>Running Adapters Directly</h2>    20     21 <p>For those server environments where you can just run the adapter code    22 (BaseHTTPRequestHandler, Twisted), you can choose to specify the    23 <code>PYTHONPATH</code> on the command line when you run the code. Here is an    24 example of this (using <code>bash</code> on GNU/Linux or UNIX    25 distributions):</p>    26 <pre>PYTHONPATH=.:examples/Common python examples/BaseHTTPRequestHandler/SimpleApp.py</pre>    27     28 <h2>Adapters Run by the Web Server</h2>    29     30 <p>For those server environments where the Web server itself runs the adapter    31 code (CGI, mod_python, WSGI), you may need to either configure the Web server    32 to alter the <code>PYTHONPATH</code>, if possible, or to add some extra lines    33 in the adapter code to change Python's <code>sys.path</code> variable. Here    34 is an example of this:</p>    35 <pre>sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")</pre>    36     37 <h2>Configuring PYTHONPATH in Java Servlet Containers</h2>    38     39 <p>In servlet container deployments, all required libraries and packages are    40 typically bundled with the application itself. Since this bundling process is    41 usually very inconvenient, a script has been included in the    42 <code>tools/JavaServlet</code> directory to make it slightly easier.</p>    43     44 <h2>Configuring PYTHONPATH in Webware</h2>    45     46 <p>Since Webware's WebKit runs as a separate process, it is possible to    47 specify <code>PYTHONPATH</code> on the command line when you start that    48 process. Here is an example of this (using <code>bash</code> on GNU/Linux or    49 UNIX distributions):</p>    50 <pre>cd WebKit    51 PYTHONPATH=/home/paulb/Software/Python/WebStack/examples/Common ./AppServer</pre>    52     53 <h2>Configuring PYTHONPATH in Zope</h2>    54     55 <p>In Zope's <code>etc/zope.conf</code> file, <code>path</code> directives    56 can be used to indicate the location of various resources. Here is an example    57 of this:</p>    58 <pre>path /home/paulb/Software/Python/WebStack/examples/Common</pre>    59 </body>    60 </html>