Gregory (Grisha) Trubetskoy
grisha at modpython.org
Mon Aug 25 21:53:22 EST 2003
On Mon, 25 Aug 2003, Russell Nelson wrote: > Maybe this is really an Apache question, but it seems to me like it > ought to come up in a mod_python context as well. Can't find it in > the documentation, the FAQ, or the mailing list archives > (Aug/Jul/Jun). > > How do I cause my python script to be run when a .html file is accessed? > http://angry-economics.russnelson.com/index.html Russell - It is pretty much an apache question. AddHandler python-program .html PythonHandler myhandler PythonDebug On should do it (AddHandler is key, the other two are shown for completness). > > How do I cause my python script to be run when any old file is accessed? > http://angry-economics.russnelson.com/ SetHandler python-program PythonHandler myhandler PythonDebug On would make every request be handled by mod_python, regardless of extension. Of course the consequence of either of the above is that the mod_python handler would either need to actually do the work of delivering the HTML itself (the next version will have req.sendfile() to make it a bit more efficient), or return apache.DECLINED to let Apache handle it after mp handler did its thing (in which case the mp handler shouldn't write anything). > In other words, I want a handler which gets run no matter what the > rest of the URL is. You'd think this would be in the documentation, > enabling people to make fully scripted sites, but it seems not to be. Here is one place where it's mentioned: http://www.modpython.org/live/current/doc-html/tut-what-it-do.html ...but I admit, the docs are written in a way as to not overlap Apache docs, which makes it difficult. > I can't insert a /foo.py/ in there because I have to preserve all the > old URLs. P.S. Glad to see you using mod_python! Grisha
|