1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
4
<title>5.4.11 PythonPath</title>
5
<META NAME="description" CONTENT="5.4.11 PythonPath">
6
<META NAME="keywords" CONTENT="modpython">
7
<META NAME="resource-type" CONTENT="document">
8
<META NAME="distribution" CONTENT="global">
9
<link rel="STYLESHEET" href="modpython.css">
10
<link rel="first" href="modpython.html">
11
<link rel="contents" href="contents.html" title="Contents">
12
<link rel="index" href="genindex.html" title="Index">
13
<LINK REL="previous" href="dir-other-po.html">
14
<LINK REL="up" href="dir-other.html">
15
<LINK REL="next" href="handlers.html">
18
<DIV CLASS="navigation">
19
<table align="center" width="100%" cellpadding="0" cellspacing="2">
21
<td><A href="dir-other-po.html"><img src="icons/previous.gif"
22
border="0" height="32"
23
alt="Previous Page" width="32"></A></td>
24
<td><A href="dir-other.html"><img src="icons/up.gif"
25
border="0" height="32"
26
alt="Up One Level" width="32"></A></td>
27
<td><A href="handlers.html"><img src="icons/next.gif"
28
border="0" height="32"
29
alt="Next Page" width="32"></A></td>
30
<td align="center" width="100%">Mod_python Manual</td>
31
<td><A href="contents.html"><img src="icons/contents.gif"
32
border="0" height="32"
33
alt="Contents" width="32"></A></td>
34
<td><img src="icons/blank.gif"
35
border="0" height="32"
36
alt="" width="32"></td>
37
<td><A href="genindex.html"><img src="icons/index.gif"
38
border="0" height="32"
39
alt="Index" width="32"></A></td>
41
<b class="navlabel">Previous:</b> <a class="sectref" href="dir-other-po.html">5.4.10 PythonOption</A>
42
<b class="navlabel">Up:</b> <a class="sectref" href="dir-other.html">5.4 Other Directives</A>
43
<b class="navlabel">Next:</b> <a class="sectref" href="handlers.html">6. Standard Handlers</A>
46
<!--End of Navigation Panel-->
48
<H2><A NAME="SECTION0074110000000000000000"> </A>
49
<a name="l2h-249"> </a>
55
<b><em class="citetitle"><a
56
href="http://httpd.apache.org/docs-2.0/mod/directive-dict.html#Syntax"
59
PythonPath <i>path</i>
60
<BR><em class="citetitle"><a
61
href="http://httpd.apache.org/docs-2.0/mod/directive-dict.html#Context"
64
server config, virtual host, directory, htaccess
65
<BR><em class="citetitle"><a
66
href="http://httpd.apache.org/docs-2.0/mod/directive-dict.html#Override"
70
<BR><em class="citetitle"><a
71
href="http://httpd.apache.org/docs-2.0/mod/directive-dict.html#Module"
77
PythonPath directive sets the PythonPath. The path must be specified
78
in Python list notation, e.g.
81
<dl><dd><pre class="verbatim">
82
PythonPath "['/usr/local/lib/python2.0', '/usr/local/lib/site_python', '/some/other/place']"
86
The path specified in this directive will replace the path, not add to
87
it. However, because the value of the directive is evaled, to append a
88
directory to the path, one can specify something like
91
<dl><dd><pre class="verbatim">
92
PythonPath "sys.path+['/mydir']"
96
Mod_python tries to minimize the number of evals associated with the
97
PythonPath directive because evals are slow and can negatively impact
98
performance, especially when the directive is specified in an
99
<span class="file">.htaccess</span> file which gets parsed at every hit. Mod_python will
100
remember the arguments to the PythonPath directive in the un-evaled
101
form, and before evaling the value it will compare it to the
102
remembered value. If the value is the same, no action is
103
taken. Because of this, you should not rely on the directive as a way
104
to restore the pythonpath to some value if your code changes it.
107
<div class="note"><b class="label">Note:</b>
108
This directive should not be used as a security measure since the
109
Python path is easily manipulated from within the scripts.
112
<DIV CLASS="navigation">
114
<table align="center" width="100%" cellpadding="0" cellspacing="2">
116
<td><A href="dir-other-po.html"><img src="icons/previous.gif"
117
border="0" height="32"
118
alt="Previous Page" width="32"></A></td>
119
<td><A href="dir-other.html"><img src="icons/up.gif"
120
border="0" height="32"
121
alt="Up One Level" width="32"></A></td>
122
<td><A href="handlers.html"><img src="icons/next.gif"
123
border="0" height="32"
124
alt="Next Page" width="32"></A></td>
125
<td align="center" width="100%">Mod_python Manual</td>
126
<td><A href="contents.html"><img src="icons/contents.gif"
127
border="0" height="32"
128
alt="Contents" width="32"></A></td>
129
<td><img src="icons/blank.gif"
130
border="0" height="32"
131
alt="" width="32"></td>
132
<td><A href="genindex.html"><img src="icons/index.gif"
133
border="0" height="32"
134
alt="Index" width="32"></A></td>
136
<b class="navlabel">Previous:</b> <a class="sectref" href="dir-other-po.html">5.4.10 PythonOption</A>
137
<b class="navlabel">Up:</b> <a class="sectref" href="dir-other.html">5.4 Other Directives</A>
138
<b class="navlabel">Next:</b> <a class="sectref" href="handlers.html">6. Standard Handlers</A>
140
<span class="release-info">Release 3.1.3, documentation updated on February 17, 2004.</span>
142
<!--End of Navigation Panel-->