1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>A. Windows Installation</title>
<META NAME="description" CONTENT="A. Windows Installation">
<META NAME="keywords" CONTENT="modpython">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="modpython.css">
<LINK REL="next" href="app-vnsinst.html">
<LINK REL="previous" href="handlers.html">
<LINK REL="up" HREF="modpython.html">
<LINK REL="next" href="app-vnsinst.html">
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="hand-z.html"><img src="icons/previous.gif"
border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A HREF="modpython.html"><img src="icons/up.gif"
border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="app-vnsinst.html"><img src="icons/next.gif"
border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Mod_python Manual</td>
<td><A href="contents.html"><img src="icons/contents.gif"
border="0" height="32"
alt="Contents" width="32"></A></td>
<td><img src="icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><A href="genindex.html"><img src="icons/index.gif"
border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="hand-z.html">6.4 ZHandler</A>
<b class="navlabel">Up:</b> <a class="sectref" HREF="modpython.html">Mod_python Manual</A>
<b class="navlabel">Next:</b> <a class="sectref" href="app-vnsinst.html">B. VMS installation</A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION009000000000000000000"> </A>
<BR>
A. Windows Installation
</H1>
<a name='l2h-158'> </a>
<P>
Notes originally created by Enrique Vaamonde <span class="email">evaamo@loquesea.com</span>
<P>
<i>Your mileage may vary with these instructions</i>
<P>
You need to have the following packages properly installed and
configured in your system:
<P>
<UL>
<LI>Python 1.5.2 or 2.0
</LI>
<LI>Apache 1.3
</LI>
<LI>Winzip 6.x or later.
<P>
</LI>
</UL>
<P>
You need to download both the mod_python.dll and the mod_python-x.tgz
(where x is the version number) files from the main page. Once you
have all the things above mentioned we're good to go.
<P>
<OL>
<LI>Installing mod_python libraries
<P>
<UL>
<LI>Use Winzip to extract the distribution file (mod_python-x.tgz) into a
temporary folder (i.e <code>C:\temp</code>):
<P>
</LI>
<LI>NOTE: If Winzip shows this warning "Archive contains one file, should
Winzip decompress it to a temporary folder?" just click on Yes, the
content of the file should appear in Winzip right after.
<P>
</LI>
<LI>Select all the files in Winzip and click on the Extract button, then
type-in the path or just browse your way to the temporary folder and
click extract.
<P>
</LI>
<LI>Open your Windows Explorer and locate the temporary folder where you
extracted the distribution file, you should have a new folder in your
temporary folder (<code>C:\temp\mod_python-x</code>).
<P>
</LI>
<LI>Move (or just drag & drop) the mod_python-x folder into the Python lib
folder (i.e <code>C:\Program Files\Python\lib</code>).
<P>
</LI>
<LI>Move the files in the folder lib inside the mod_python folder
(<code>C:\Program Files\Python\lib\mod_python-x\lib\mod_python</code>) to the
<code>C:\Program Files\Python\lib\mod_python</code> folder. It's safe to delete
these folders we just emptied.
<P>
</LI>
</UL>
<P>
</LI>
<LI>Integrating it with Apache
<P>
Once the distribution file is correctly extracted and later moved into
the Python directory, it's time to modify your Apache configuration
(httpd.conf) and integrate the server with mod_python. These are a few
steps we must do first:
<P>
<UL>
<LI>Locate the file mod_python.dll that you downloaded before and move it
to Apache's modules folder (i.e <code>C:\Program Files\Apache Group\Apache\modules</code>).
<P>
</LI>
<LI>Go to the Apache configuration folder (i.e <code>C:\Program Files\Apache Group\Apache\conf\</code>) and edit the httpd.conf file.
<P>
Add the following line in the section "Dynamic Shared Object (DSO)
Support" of the httpd.conf file:
<P>
<dl><dd><pre class="verbatim">
LoadModule python_module modules/mod_python.dll
</pre></dl>
<P>
</LI>
<LI>Add the following lines in the section ScriptAlias and CGI of the httpd.conf:
<P>
<dl><dd><pre class="verbatim">
<Directory "<Your Document Root>/python">
AddHandler python-program .py
PythonHandler mptest
PythonDebug on
</Directory>
</pre></dl>
<P>
NOTE: Replace the <Your Document Root> above with the Document Root
you specified on the DocumentRoot directive in the Apache's httpd.conf
file.
<P>
</LI>
<LI>Last, create a folder under your Document Root called python.
<P>
</LI>
</UL>
<P>
</LI>
<LI>Testing
<P>
<UL>
<LI>Create a text file in the folder we created above and call it mptest.py
(you can use Notepad for this).
<P>
</LI>
<LI>Insert the following lines and save the file (Make sure it gets saved
with the .py extension):
<P>
<dl><dd><pre class="verbatim">
from mod_python import apache
def handler(req):
req.content_type = "text/plain"
req.send_http_header()
req.write("Hello World!")
return apache.OK
</pre></dl>
<P>
</LI>
<LI>Make sure Apache is running (or launch it!) and then point your
browser to the URL referring to the mptest.py, you should see "Hello
World!".
<P>
</LI>
</UL>
</LI>
</OL>
<P>
That's it, you're ready to roll!! If you don't see the "Hello World!"
message, the next section is for you.
<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="hand-z.html"><img src="icons/previous.gif"
border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A HREF="modpython.html"><img src="icons/up.gif"
border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="app-vnsinst.html"><img src="icons/next.gif"
border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Mod_python Manual</td>
<td><A href="contents.html"><img src="icons/contents.gif"
border="0" height="32"
alt="Contents" width="32"></A></td>
<td><img src="icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><A href="genindex.html"><img src="icons/index.gif"
border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="hand-z.html">6.4 ZHandler</A>
<b class="navlabel">Up:</b> <a class="sectref" HREF="modpython.html">Mod_python Manual</A>
<b class="navlabel">Next:</b> <a class="sectref" href="app-vnsinst.html">B. VMS installation</A>
<hr>
<span class="release-info">Release 2.7.8, documentation updated on April 19, 2002.</span>
</DIV>
<!--End of Navigation Panel-->
</BODY>
</HTML>
|