[mod_python] Trying to greet the world -trouble getting the .py &/or .psp files to function

Waitman Gobble waitman at waitman.net
Mon Nov 14 14:50:21 EST 2005


the hi.py example is likely meant to be used with mod_python.publisher. my


otherwise you need to play with the request object.

(with mod_python.publisher)

def hello():
    return "howdy"

(without mod_python.publisher)

from mod_python import apache

def handler(req):

    req.content_type = "text/html"
    req.write("I am Alive")
    return apache.OK

your hi.py script doesn't seem to be going through mod_python. not sure
what you are doing in your control panel thingy.

Here is an example mod_python setup that seems to function:

        <Directory "/home/wwweb/pyblog/htdocs">
            SetHandler mod_python
            PythonHandler mod_python.publisher
            Options none
            AllowOverride none
            Allow from all
            <Files ~ "\.(gif|jpe?g|png|html?|css|js)$">
                SetHandler None
            <Files *.pyc>
                Deny from all

But if you wanted to just send everything to your python script without
using mod_python.publisher:

Change PythonHandler to "myscript" (*myscript.py*)

If you want to associate .py files to "python" you would do something
_like_ this

AddHandler cgi-script .py
Options +ExecCGI

(first line of your cgi script would be the shebang)

> but I'm not able to get the pages served correctly.
> My internet host provider assures me that mod_python is setup correctly.
> thoughts?

Waitman Gobble
(707) 237-6921

More information about the Mod_python mailing list