[mod_python] what's the best way to configure mod_python?

Diogo Pitz dbp.listas at gmail.com
Sun Jul 2 13:58:58 EDT 2006

Hello everybody!

I've just started studying mod_python, and I have some doubts about how to
configure it correctly.
I've put this lines in my .conf apache file:

<Directory "C:\arquivos_diogo\python">
        AddHandler mod_python .py
        PythonHandler Script1
        PythonDebug On

<Directory "C:\arquivos_diogo\python">
    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    PythonDebug On

with this I have my codes working, but not in the way I want.
I have a .py file called helloworld.py, and this is its code:

from mod_python import apache

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

to see "Hello World" in my browser, I have to type
http://localhost/python/helloworld.py/handler .
the problem is this "/handler"! I would like to call my file in the browser
only by its name, in this case helloworld.py.
I know how to configure apache to do it, but doing the things on this way,
I'd have to put in the apache conf the name of each file I want to see in
the browser =\
is there a easier way to do it?

and one more question, can I write a html file in python, like this?

print "<html><body><p>something</p></body></html>"

or mod_python doesn't allow me to make this? if it doesn't, what solution
can be used to do it?

thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060702/bdbcdd13/attachment.html

More information about the Mod_python mailing list