| Michael C. Neel 
    neel at mediapulse.com Wed Mar 26 12:08:01 EST 2003 
 In httpd.conf, for the server add:
    <Files ~ "\.html$">
        SetHandler python-program
        PythonPath "sys.path+['/home/sites/mysite.com/modules']"
        PythonHandler www
        #PythonDebug On
    </Files>
With a www.py in the /home/sites/mysite.com/modules directory.  In
www.py you can put your request handler.
You might want to take a look at Albatross, it sounds very close to what
you are doing, http://www.object-craft.com.au/projects/albatross/
Mike
-----Original Message-----
From: Dmitry Orlov [mailto:dorlov at banta-im.com] 
Sent: Wednesday, March 26, 2003 11:33 AM
To: mod_python at modpython.org
Subject: [mod_python] HTML filtering
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?
-Dmitry
_______________________________________________
Mod_python mailing list
Mod_python at modpython.org
http://www.modpython.org/mailman/listinfo/mod_python
 |