Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 12aef6395c3678c929b08cd723fc1673 > files > 24

mod_python-2.7.6-1mdk.i586.rpm

<!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">&nbsp;</A>
<BR>
A. Windows Installation
</H1>
<a name='l2h-158'>&nbsp;</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:&#92;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:&#92;temp&#92;mod_python-x</code>).

<P>
</LI>
<LI>Move (or just drag &amp; drop) the mod_python-x folder into the Python lib
folder (i.e <code>C:&#92;Program Files&#92;Python&#92;lib</code>).

<P>
</LI>
<LI>Move the files in the folder lib inside the mod_python folder
(<code>C:&#92;Program Files&#92;Python&#92;lib&#92;mod_python-x&#92;lib&#92;mod_python</code>) to the
<code>C:&#92;Program Files&#92;Python&#92;lib&#92;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:&#92;Program Files&#92;Apache Group&#92;Apache&#92;modules</code>).

<P>
</LI>
<LI>Go to the Apache configuration folder (i.e <code>C:&#92;Program Files&#92;Apache Group&#92;Apache&#92;conf&#92;</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">                         
&lt;Directory "&lt;Your Document Root&gt;/python"&gt;
   AddHandler python-program .py
   PythonHandler mptest
   PythonDebug on
&lt;/Directory&gt;
</pre></dl>                

<P>
NOTE: Replace the &lt;Your Document Root&gt; 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.6, documentation updated on August 04, 2001.</span>
</DIV>
<!--End of Navigation Panel-->

</BODY>
</HTML>