[mod_python] setup problem - apache not recognizing python script

John Cartwright John.C.Cartwright at noaa.gov
Thu Jun 15 13:11:30 EDT 2006


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
>>     
>
>   


More information about the Mod_python mailing list