[mod_python] setup problem - apache not recognizing python script

Graham Dumpleton grahamd at dscpl.com.au
Thu Jun 15 20:00:56 EDT 2006


I can't give a more detailed answer right now, but at least have a  
read of:

   http://www.dscpl.com.au/articles/modpython-001.html

This gives an alternate set of instructions to follow through for a  
first handler
which covers some of the gotchas and points out where to look if  
there are
problems.

This may not help as it looks like the site-packages components of  
mod_python
are not installed for the version of Python being used by Apache when  
running
mod_python. This can occur where it simply isn't installed or where  
you have
multiple versions of Python and Apache is using the wrong one.

Anyway, try some of the suggestions in that article and see what you  
can come
up with.

Graham

On 16/06/2006, at 3:11 AM, John Cartwright wrote:

> Hi Joshua,
>
> thanks for your prompt reply!  You're right - that was part of the
> problem.  However, now it's complaining that it cannot import
> "mod_python.apache".  Shouldn't the PYTHONPATH variable be set by the
> PythonPath directive and inherited by the handler script?  I've
> added
>
> PythonPath "sys.path+['/usr/lib']"
> PythonPath "sys.path+['/usr/lib/python2.2/site-packages']"
>
> and confirmed that  /usr/lib/python2.2/site-packages/mod_python  
> contains
> the python module.
>
> thanks again for your help.
>
> -- john
>
>
> Joshua Ginsberg wrote:
>> Your Alias and your Python path both have /mnt at the begining. Your
>> Directory tag does not. Is that it?
>>
>> -jag
>>
>> On Thu, 2006-06-15 at 10:24 -0600, John Cartwright wrote:
>>
>>> Hello All,
>>>
>>> for some reason apache is not recognizing my python handler,  
>>> returning
>>> only the text of the python program.  Can someone please tell me  
>>> what's
>>> wrong in my configuration below:
>>>
>>> alias /python "/mnt/data1/htdocs/python"
>>> <Directory /data1/htdocs/python>
>>>   SetHandler python-program
>>>   PythonPath "sys.path+['/mnt/data1/htdocs/python']"
>>>   PythonHandler mptest
>>>   PythonDebug On
>>> </Directory>
>>>
>>>
>>>
>>> Here's the code for the handler (/data1/htdocs/python/mptest.py):
>>>
>>> import mod_python
>>> from mod_python import apache
>>>
>>> def handler(req):
>>>     req.send_http_header()
>>>     req.write("Hello World!")
>>>     return apache.OK
>>>
>>> -------------------------------------------------------------------- 
>>> ------------------------------------------------------------
>>> This is apache 2.0.46, mod_python 3.0.3, and RHEL WS 4.
>>>
>>> Thanks!
>>>
>>> -- john
>>>
>>> _______________________________________________
>>> Mod_python mailing list
>>> Mod_python at modpython.org
>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>>
>>
>>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list