[mod_python] How to run python scripts on apache?

ejaz shah ejazshah85 at gmail.com
Mon Oct 5 21:08:17 EDT 2009


Hi All,

How can we enbale all python script to be executed on apache server. I know
how to add handler to the config file but it works only for a single
file.Changes made in the apache config file is:
   <Directory "C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/test/Upload/uploaddocs">
      AddHandler mod_python .py
      PythonHandler mptest
      PythonDebug On
</Directory>

where mp.test file is as under:
  from mod_python import apache

def handler (req):
        req.content_type = 'text/plain'
        req.write("Hello World!!!")
        return apache.OK


So any python file when executed on server side is processed via mptest
which no matter what that .py script want it to do it always prints out
Hello World!!..

I want to generalize it. Any .py shall be executed on apache.
Kindly let me know if any one of you know about this.

Regards,

Ejaz Shah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20091005/b06ef9a6/attachment.html


More information about the Mod_python mailing list