1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/docs/pythonpath.html Sat Apr 09 12:32:28 2005 +0000
1.3 @@ -0,0 +1,61 @@
1.4 +<?xml version="1.0" encoding="iso-8859-1"?>
1.5 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
1.6 + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1.7 +<html xmlns="http://www.w3.org/1999/xhtml">
1.8 +<head>
1.9 + <title>Getting PYTHONPATH Right</title>
1.10 + <meta name="generator" content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.11 + <link href="styles.css" rel="stylesheet" type="text/css" />
1.12 +</head>
1.13 +
1.14 +<body>
1.15 +<h1>Getting PYTHONPATH Right</h1>
1.16 +
1.17 +<p>When deploying your application, it is essential that it has access to all
1.18 +the necessary libraries and packages that it uses. If such libraries and
1.19 +packages were installed using the standard <code>setup.py</code> program,
1.20 +then you may only need to worry about the application itself being found by
1.21 +Python.</p>
1.22 +
1.23 +<h2>Running Adapters Directly</h2>
1.24 +
1.25 +<p>For those server environments where you can just run the adapter code
1.26 +(BaseHTTPRequestHandler, Twisted), you can choose to specify the
1.27 +<code>PYTHONPATH</code> on the command line when you run the code. Here is an
1.28 +example of this (using <code>bash</code> on GNU/Linux or UNIX
1.29 +distributions):</p>
1.30 +<pre>PYTHONPATH=.:examples/Common python examples/BaseHTTPRequestHandler/SimpleApp.py</pre>
1.31 +
1.32 +<h2>Adapters Run by the Web Server</h2>
1.33 +
1.34 +<p>For those server environments where the Web server itself runs the adapter
1.35 +code (CGI, mod_python, WSGI), you may need to either configure the Web server
1.36 +to alter the <code>PYTHONPATH</code>, if possible, or to add some extra lines
1.37 +in the adapter code to change Python's <code>sys.path</code> variable. Here
1.38 +is an example of this:</p>
1.39 +<pre>sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")</pre>
1.40 +
1.41 +<h2>Configuring PYTHONPATH in Java Servlet Containers</h2>
1.42 +
1.43 +<p>In servlet container deployments, all required libraries and packages are
1.44 +typically bundled with the application itself. Since this bundling process is
1.45 +usually very inconvenient, a script has been included in the
1.46 +<code>tools/JavaServlet</code> directory to make it slightly easier.</p>
1.47 +
1.48 +<h2>Configuring PYTHONPATH in Webware</h2>
1.49 +
1.50 +<p>Since Webware's WebKit runs as a separate process, it is possible to
1.51 +specify <code>PYTHONPATH</code> on the command line when you start that
1.52 +process. Here is an example of this (using <code>bash</code> on GNU/Linux or
1.53 +UNIX distributions):</p>
1.54 +<pre>cd WebKit
1.55 +PYTHONPATH=/home/paulb/Software/Python/WebStack/examples/Common ./AppServer</pre>
1.56 +
1.57 +<h2>Configuring PYTHONPATH in Zope</h2>
1.58 +
1.59 +<p>In Zope's <code>etc/zope.conf</code> file, <code>path</code> directives
1.60 +can be used to indicate the location of various resources. Here is an example
1.61 +of this:</p>
1.62 +<pre>path /home/paulb/Software/Python/WebStack/examples/Common</pre>
1.63 +</body>
1.64 +</html>