开发者

Using Mako Templates in Pyramid with Google App Engine

开发者 https://www.devze.com 2023-02-05 08:32 出处:网络
With Pyramid and mod_wsgi, to use mako templates you just add this line to development.ini: mako.directories = house:templates

With Pyramid and mod_wsgi, to use mako templates you just add this line to development.ini:

mako.directories = house:templates

Unfortunately, Pyramid in the Google App Engine doesn't have an development.ini file, and I get the following error:

File "appengine-monkey/pyramidapp/app/lib/python/pyramid-1.0a9-py2.5.egg/pyramid/mako_templating.py", line 74, in renderer_factory
'Mako template used without a ``mako.directories`` setting')
Con开发者_如何转开发figurationError: Mako template used without a ``mako.directories`` setting

Is there any way to pass this environment variable?


I found out from the pylons-devel mailing list. Figured I would post the answer here.

The way to do this is pass it to the Configurator as a setting. So in the __init__.py file make the following change:

config = Configurator(settings={'mako.directories':['house:templates']}) 
0

精彩评论

暂无评论...
验证码 换一张
取 消