[mod_python] templates in stead of PSP

David Fraser davidf at sjsoft.com
Mon Aug 21 08:31:04 EDT 2006

Thomas Andrews wrote:
> Hi,
> I would like to use a templating 'language' like cheetah/kid/markup/spyce(?)
> instead of straight PSP. I don't want to run webware/turbogears/... in
> addition - I just want apache on it's own. Has anyone done this?
> I don't really mind at present which templating app I have to use, so
> long as I can get a working recipe, (though I'd *really* rather not use
> cgi to do it.)
> I tried to get kid going using the apache config below, but no matter
> what I try I get errors from apache:
> >From syslog:
>     "Invalid URI in request GET /kid/sysinfo.kid HTTP/1.1, referer:
>     http://localhost/kid/"
> The error reported in the browser is:
>     Bad Request
>     Your browser sent a request that this server could not understand.
>     Apache/2.0.55 (Debian) mod_python/3.1.3 Python/2.3.5 PHP/4.4.2-1.1
>     Server at localhost Port 80
> Here's my Apache config:
>     # ++++++++++++++++++++++++++++++++++
>     Alias /kid/ /var/www/kid/
>     <Directory /var/www/kid/>
>         Options +ExecCGI
>         Action kid-file kid_handler.cgi
>         AddHandler kid-file .kid
>     </Directory>
>     # ++++++++++++++++++++++++++++++++++
> What can I be doing wrong in the "Action" line above?
> Can anyone provide me with a basic working setup for any of the above
> apps? (It doesn't have to be Kid.)
OK, Seeing as you're on the mod_python list - why are you using CGI?

I would recommend either writing your own handler using mod_python,
which calls Kid internally and returns the results, or using one of the
existing web frameworks that support Kid (Django, etc, etc)
Since you usually end up writing a bit of Python code outside the
template anyway, this bootstrapping often ends up being worth it - and
you'll get performance gains by using mod_python rather than cgi ...


More information about the Mod_python mailing list