[mod_python] Setting the python executable

Evert Rol evert.rol at gmail.com
Thu Apr 10 14:20:39 EDT 2008


   Hi all,

I'm having a hard time telling Apache (or mod_python) to tell which  
python executable to use.
The thing is, I don't have a root access, so I'm running the Apache  
server and python 2.5 under my user account. Both have also been  
installed this way, ie, they are in my in the directory tree of my  
user account.
To avoid interference with the older system python (2.3), I just call  
python with the full path (I try to avoid changing my path, since some  
of these scripts run as cron jobs, bypassing a lot of setup files).
Bit of debugging (eg, print sys.executable in a mod_python script)  
showed, however, that mod_python is still happily using the system  
python, not my locally installed. That goes fine up to a certain  
point, but it does of course crash in the end. I had compiled  
mod_python with the --with-python and --with-apxs options, but looks  
like that doesn't help here.
After some further searching around, I came across the Action  
directive for Apache; still didn't work, although that may be simply  
because I did that incorrectly.

For the record, I'm using mod_python for Django, maing things  
potentially more convoluted.
Here's what my latest attempt at getting this to work (still failing  
after plenty of Apache restarts):

Action thepython-program /home/evert/sw/bin/python2.5
# Django directory
<Location "/testing/">
     SetHandler thepython-program
     PythonHandler django.core.handlers.modpython
     SetEnv DJANGO_SETTINGS_MODULE mysite.settings
     PythonDebug On
</Location>


I'm beginning to run out of ideas (& Google search terms). Does anyone  
have any pointers?

   Evert



More information about the Mod_python mailing list