[mod_python] cg-bin files execution

Jorey Bump list at joreybump.com
Thu Dec 2 14:32:35 EST 2004


John wrote:

> Here is my error_log
> 
> [Thu Dec  2 19:50:39 2004] [notice] mod_python: (Re)importing
> mod_python.publisher from None
> [Thu Dec  2 19:51:27 2004] [notice] mod_python: (Re)importing
> mod_python.publisher from None

Normal.

> When i try to lunch the *.py files i receive and 404 error (page does not
> exist)

Publisher expects you to point to a function *within* the module:

  http://host/module.py/somefunction

Here's a very easy way to test Publisher:

<Directory /var/www/documentroot>
    AddHandler python-program .py
    PythonHandler mod_python.publisher
    PythonDebug On
</Directory>

Create test.py:

def hello(req):
     x = "Hello, world!"
     return x

Restart apache (if you modified httpd.conf), point your browser to:

  http://localhost/test.py/hello

Furthermore, if you add the directive:

  Options MultiViews

to your directory section, you should be able to hide the extension 
(assuming there is no conflict with another test.* file):

  http://localhost/test/hello



More information about the Mod_python mailing list