使用Google App Engine中使用金字塔中的Mako模板
题
使用金字塔和mod_wsgi,要使用mako模板,您只需将此行添加到development.ini:
mako.directories = house:templates
不幸的是,Google App Engine中的金字塔没有开发.ini文件,我会收到以下错误:
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')
ConfigurationError: Mako template used without a ``mako.directories`` setting
有什么方法可以通过此环境变量?
解决方案
我从塔楼邮寄列表中找到了。我想我会在这里发布答案。
这样做的方法是将其作为设置传递给配置器。所以在 __init__.py
文件进行以下更改:
config = Configurator(settings={'mako.directories':['house:templates']})
不隶属于 StackOverflow