[mod_python] HTML filtering

Scott Chapman scott_list at mischko.com
Thu Mar 27 13:40:24 EST 2003

You might want to look at Spyce (http://spyce.sourceforge.net/) also.  It 
allows you to embed Python in HTML.


On Wednesday 26 March 2003 8:32 am, Dmitry Orlov wrote:
I've started looking into switching some sites that use Python through
cgi to mod_python. The sites work via HTML filtering, sort of like PHP,
with bits of Python stuck inside HTML files. I tried to look for docs
that would show how I could set up such a scheme for mod_python, but
haven't found anything (yet).

Currently, we configure Apache using ScriptAlias and Action directives,
so that any request for a .html file within a certain Location gets
piped through the cgi which runs Python via an HTML filter.

The HTML filter coded in C/flex. It does variable substitution for
things like {$foo}, runs Python snippets between <?python and ?> tags a
la PHP, and a bunch of other nifty things, like form pre-population.

This scheme works quite well, and is fast if one uses fastcgi, but is a
bit complicated. I am hoping to simplify it using mod_python while
retaining the excellent performance.

I am thinking that the ideal drop-in replacement scheme would be to make
our HTML filter into a Python module, and call it via an output filter.
But how do I set it up so that mod_python runs for .html files instead
of .py files?

Mod_python mailing list
Mod_python at modpython.org

More information about the Mod_python mailing list