|
Luis M. Gonzalez
luismg at gmx.net
Mon May 8 21:17:38 EDT 2006
Thanks for your reply Graham!
Well, this is my Apache configuraton:
<Directory "C:/Archivos de programa/xampp/htdocs">
AddHandler python-program .py .psp
PythonHandler mod_python.publisher | .py
PythonHandler mod_python.psp | .psp
</Directory>
I actually managed to use Cheetah templates with publisher, without any special handler at all.
All I had to do is compile the template into a .py module first (cheetah compile mytemplate.tmpl ---> mytemplate.py).
Then I would simply use it as follows:
from mytemplate import mytemplate
import MySQLdb
def index(req):
con = MySQLdb.connect('localhost','root','','vic')
cur = con.cursor()
cur.execute('select * from clientes')
res = cur.fetchall()
con.close()
req.content_type='text/html'
templ = mytemplate(searchList=[{'res':res}])
return templ
However, I'd like to use templates without having to compile them first.
My questions are:
1) How should I configure Apache?
2) What's the best handler to use Cheetah + publisher?
LUIS
----- Original Message -----
From: "Graham Dumpleton" <grahamd at dscpl.com.au>
To: "Luis M. Gonzalez" <luismg at gmx.net>
Cc: <mod_python at modpython.org>
Sent: Monday, May 08, 2006 8:19 PM
Subject: Re: [mod_python] publisher + cheetah
> Luis M. Gonzalez wrote ..
>> Hi,
>>
>> I've been trying (unsuccesfuly) to use Cheetah templates with mod_python
>> publisher.
>> As far as I could see in previous posts and other sources, Graham's handler
>> is the ultimate way of making it work,
>> But I'm still having trouble: http://www.modpython.org/pipermail/mod_python/2005-March/017639.html
>>
>> I wonder what would be the httpd.conf configuration?
>> Is there any other detail I should be aware of?
>>
>> Any hint would be highly appreciated...
>
> There was a mistake in the apache.import_module() call, see:
>
> http://wiki.cheetahtemplate.org/cheetah-recipes.html?
>
> for further commentary on this code.
>
> If after working through stuff in that file you still have issues, you'll need
> to provide further information about what Apache configuration you are
> using and what errors you are actually getting in the Apache error log.
>
> Graham
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060508/67d1a308/attachment.html
|