Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Running mod_python on Apache on Windows2000 *

Reply
Thread Tools

Running mod_python on Apache on Windows2000 *

 
 
Rolfe
Guest
Posts: n/a
 
      09-29-2003
Hi, I struggled, and got mod_python running on Apache/Win2k. Follow
these instructions verbatim and you shouldn't have any trouble. These
instructions are based on
"http://www.modpython.org/live/current/doc-html/inst-testing.html".
I've added specific information such as Windows filepaths and
filenames so there's no ambiguity on what you should do. I encourage
you to copy and paste to avoid typing errors.
Cheers,

Rolfe

INSTALLING MOD_PYTHON

1. Make a default installations of the latest/best version of Apache.

2. Make a default installation of the latest/best version of
mod_python.

3. Open C:\Program Files\Apache Group\Apache2\conf\httpd.conf in
Notepad.

4. In httpd.conf, just below the line "#LoadModule ssl_module
modules/mod_ssl.so", copy and paste the following section:

#Start of section pasted in by YOURNAMEGOESHERE

LoadModule python_module modules/mod_python.so

<Directory "C:\Program Files\Apache Group\Apache2\htdocs/test/">

AddHandler python-program .py
PythonHandler mptest
PythonDebug On

</Directory>
<Directory "C:\Program Files\Apache Group\Apache2\cgi-bin/">

AddHandler python-program .py
PythonHandler mptest
PythonDebug On

</Directory>
#End of section pasted in by YOURNAMEGOESHERE

(NOTE: Don't mess around with the other configuration settings in
httpd.conf, - leave good enough alone. Don't worry about the
forward/backward slashes either - it doesn't matter.)

5. Save and close httpd.conf and wait a few seconds.

6. Restart Apache by clicking the Apache monitor icon in your systray
and selecting Apache2=>Restart.

PROCEDURE COMPLETED

##### TESTING MOD_PYTHON #######

1. Create a directory called "test" in htdocs so you end up with
"C:\Program Files\Apache Group\Apache2\htdocs\test"

2. Create a text file called mptest.py in "C:\Program Files\Apache
Group\Apache2\htdocs\test"

3. Paste the following text into mptest.py:

from mod_python import apache

def handler(req):

req.write("Hello World!")
return apache.OK

4. Save and close mptest.py.
5. In your file browser, copy and paste mptest from "C:\Program
Files\Apache Group\Apache2\htdocs\test" to "C:\Program Files\Apache
Group\Apache2\cgi-bin".

6. Assuming your sitting at the same machine that's running Apache,
enter the URL "http://localhost/test/mptest.py" in your web browser.
The browser displays "Hello World!" and nothing else. This confirms
that Apache can run cgi scripts in the /test/ directory.

7. Repeat step 6 using the URL "http://localhost/cgi-bin/mptest.py"
instead. The browser displays "Hello World!" and nothing else. This
confirms that Apache can run cgi scripts in the /cgi-bin/ directory.

PROCEDURE COMPLETED - mod_python works!

######## NOTES ######### Remove either of the following sections (from
<Directory to </Directory>) in order to disable cgi scripts in a
particular directory. I understand it is very poor security to run cgi
scripts under htdocs, so I'd try getting rid of that one first.

<Directory "C:\Program Files\Apache Group\Apache2\htdocs/test/">

AddHandler python-program .py
PythonHandler mptest
PythonDebug On

</Directory>
<Directory "C:\Program Files\Apache Group\Apache2\cgi-bin/">

AddHandler python-program .py
PythonHandler mptest
PythonDebug On

</Directory>
######### ACKNOWLEDGEMENTS ########## Thank you, Steve Holden, for
your guidance. I'm very much looking forward to your book, Python Web
Programming.

Thank you Peter Maas for your response on comp.lang.python
 
Reply With Quote
 
 
 
 
M-a-S
Guest
Posts: n/a
 
      10-03-2003
Any success with Apache/2.0.47 (Win32) + Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on win32 ?
M-a-S


"Rolfe" <> wrote in message news: om...
> Hi, I struggled, and got mod_python running on Apache/Win2k. Follow
> these instructions verbatim and you shouldn't have any trouble. These
> instructions are based on
> "http://www.modpython.org/live/current/doc-html/inst-testing.html".
> I've added specific information such as Windows filepaths and
> filenames so there's no ambiguity on what you should do. I encourage
> you to copy and paste to avoid typing errors.
> Cheers,
>
> Rolfe
>
> <...>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems running Apache FOP: org.apache.fop.fo.FOTreeBuilder fatalError Pablo Java 0 03-28-2007 02:31 PM
mod_python.so is garbled mod_python.so is garbled blbmdsmith Python 1 12-14-2006 12:15 AM
problem running a python script using apache,mod_python on linux neha Python 1 10-19-2005 04:27 PM
A very simple benchmark of Python based web server: Zope, mod_python with Apache, Twisted Framework Bowen Chiu Python 1 08-09-2003 05:50 PM
Apache mod_python and Sessions Markus Schaber Python 7 07-08-2003 05:55 PM



Advertisments
 



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