[mod_python] Unable to execute python sample script

Graham Dumpleton grahamd at dscpl.com.au
Fri Mar 4 21:59:30 EST 2005


If having any difficulties with mod_python, it is always a good idea to  
consult the Apache error log file. The log file is also useful for  
finding information about Python modules that mod_python is loading.

When starting out with mod_python, the first thing you would want to  
look for in the error log is evidence that mod_python is actually being  
loaded by Apache. The startup message of mod_python takes the following  
form:

[Tue Feb 01 16:08:21 2005] [notice] Apache/2.0.51 (Unix)
   mod_python/3.1.3 Python/2.3 configured -- resuming normal operations

The first time after a restart that a particular content handler needs  
to be loaded, mod_python will output a message into the log file to  
indicate this. The import message for the module containing the content  
handler will be of the form:

[Tue Feb 01 16:09:32 2005] [notice] mod_python: (Re)importing module  
'mptest'

If you can't find the startup mod_python message in the log file,  
Apache may not have been restarted properly or the loading of the  
module may not have been configured correctly.

Thus, first see if you can find any of these messages.


On 05/03/2005, at 2:51 AM, Adithya Buddhavarapu wrote:

>  Hi,
>  I have the following configuration:
>  Apache/2.0.53 (Win32) mod_python/3.1.3 Python/2.3.3 on Windows 2000.
>
>  1. I added the following information to httpd.conf
>  -----------------------------httpd.conf---------------------
>  a. LoadModule python_module modules/mod_python.s
>
>  b.
> <Directory /htdocs/test>
>          AddHandler python_module .py
>                  PythonHandler mptest
>          PythonDebug On
>  </Directory>
> -----------------------------------------------------------
>
>  2. The mptest.py is there under apacheroot/htdocs/test folder
>
>
>  3. The mptest.py has
>  --------------------------------------
>  from mod_python import apache
>
>      def handler(req):
>          req.content_type = "text/html"
>          req.write("Hello World!")
>          return apache.OK
>  -------------------------------------
>
>  When I try "http://localhost/test/mptest.py" the above text (in  
> mptest.py) is returned. It does not seem like mod_python is processing  
> it. How do I debug? Appreciate and suggestions.
>  Thanks,
>  Adithya
>
>   
> <adithya.buddhavarapu.vcf>_____________________________________________ 
> __
> 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