通过 Google App Engine 在 Pyramid 中使用 Mako 模板
使用 Pyramid 和 mod_wsgi,要使用 mako 模板,只需将此行添加到development.ini:
mako.directories = house:templates
不幸的是,Google App Engine 中的 Pyramid 没有development.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
有没有办法通过这个环境变量?
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')
ConfigurationError: Mako template used without a ``mako.directories`` setting
Is there any way to pass this environment variable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是从 pylons-devel 邮件列表中找到的。我想我会把答案发布在这里。
执行此操作的方法是将其作为设置传递给配置器。因此,在
__init__.py
文件中进行以下更改: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: