[mod_python] writting a handler in python

Graham Dumpleton grahamd at dscpl.com.au
Tue Jun 28 20:20:49 EDT 2005

Alejandro Mery wrote ..
> hi, i need to do a mod_foo (written in python) to be able to:
> AddHandler Foo .foo
> can you give me a hint, url or something to learn how can i benefit of
> mod_python to achieve my goal?

Reading the documentation on the mod_python site would be a good start.


Having done that, then try and work out what the following does:

  # .htaccess file

  AddHandler python-program .foo
  PythonHandler mod_foo
  PythonDebug On

  # mod_foo.py file

  from mod_python import apache

  def handler(req):
    req.content_type = "text/plain"
    req.write("uri = %s"%req.uri)
    return apache.OK


More information about the Mod_python mailing list