[mod_python] Apache not executing python scripts...

Lee Brown administrator at leebrown.org
Tue Jun 21 11:48:08 EDT 2005


Greetings!

Try this:

def handler(req):
    req.content_type = 'text/plain'
    req.write("Hello World!")
    return apache.OK 

Best Regards,
Lee E. Brown
(administrator at leebrown.org)

-----Original Message-----
From: mod_python-bounces at modpython.org
[mailto:mod_python-bounces at modpython.org] On Behalf Of Wojtek Dabrowski
Sent: Tuesday, June 21, 2005 11:35 AM
To: mod_python at modpython.org
Subject: [mod_python] Apache not executing python scripts...

Hello everybody!

I just installed apache 2 and mod_python (apt-get install apache2
libapache2-mod-python, on debian). apache 2 works fine, but I can't get
mod_python to work, I keep getting the suggestion to download my .py file :(

When I restart apache, I get the following in error.log:

[Tue Jun 21 17:17:48 2005] [notice] caught SIGTERM, shutting down [Tue Jun
21 17:17:49 2005] [notice] mod_python: Creating 32 session mutexes based on
6 max processes and 25 max threads.
[Tue Jun 21 17:17:49 2005] [notice] Apache/2.0.54 (Debian GNU/Linux)
mod_python/3.1.3 Python/2.3.5 configured -- resuming normal operations

which, to me, indicates that mod_python is getting loaded correctly.

I have the following in my httpd.conf:

<Directory /var/www/Dwojtek/>
    AddHandler mod_python .py
    PythonHandler mptest
    PythonDebug On
</Directory>

I also have a .htaccess in /var/www/Dwojtek/, containing the lines:

AddHandler mod_python .py
PythonHandler mptest
PythonDebug On

But when I go to http://127.0.0.1/Dwojtek/mptest.py, I get a download box. I
don't wanna download the script, I want it executed :(

The corresponding line in the access.log is:
127.0.0.1 - - [21/Jun/2005:17:31:01 +0200] "GET /Dwojtek/mptest.py HTTP/1.1"
200 12 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8)
Gecko/20050511 Firefox/1.0.4"

Which seems correct, too...

The mptest.py is, by the way:

from mod_python import apache

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

Oh, and when I go to http://127.0.0.1/Dwojtek/, I just get a directory
listing.

Anybody any ideas what I may be doing wrong? :(

Thanks a lot in advance,
-Wojtek

--
This is a .signature-virus. If you see this, copy it into your .signature!
If you don't know what a .signature is, you've most probably been infected
by another virus of name Microsoft. In this case, please remove yourself
from my fov or infect yourself with linux ;)




More information about the Mod_python mailing list