[mod_python] transhandler setup?

IR labs labs at ixopusada.com
Thu Aug 25 07:21:16 EDT 2005


Hi All, a mod_python newbie here.

I am trying to set up my server using mod_python's transhandler, but I 
can't figure out the right configuration. I am experimenting with the 
most crude and basic uri translation possible: every request should be 
redirected to main.py. But somehow apache doesn't want to do that. 
Right now it still displays static pages (.html files) with images, etc 
etc. (where I would think req.filename = 
'/var/www/mod_python_test/main.py' should prevent all of that.)

This is my setup:

from httpd.conf :
-----------------------------------------
...
<IfModule mod_python.c>
     AddHandler mod_python .py
     PythonPath "sys.path + ['/var/www/mod_python_test/']"
     PythonTransHandler translate

</IfModule>
...
-----------------------------------------

my script
/var/www/mod_python_test/translate.py :
-----------------------------------------
from mod_python import apache

def transhandler(req):
	req.filename = '/var/www/mod_python_test/main.py'
	return apache.OK
-----------------------------------------

using
FreeBSD 5.2.1
Apache 2.0.54
mod_python 3.1.4
Python 2.3.2


Note that my main.py does work through the .htaccess in 
/var/www/mod_python_test/
-----------------------------------------
AddHandler mod_python .py
PythonHandler main
PythonDebug On
-----------------------------------------

But it (main.py) should be called for all the url's requested (not just 
for /mod_python_test/whatever.py and friends.)
thx
dirk




-----------------------------
Dirk van Oosterbosch
de Wittenstraat 225
1052 AT Amsterdam
the Netherlands

http://labs.ixopusada.com
-----------------------------




More information about the Mod_python mailing list