金字塔上扩展名为.html的Jinja2模板?

时间:2021-03-23 20:48:37

How can I use a jinja2 template with a .html extension in pyramid? For instance, I want the view configuration to look like,

如何在金字塔中使用扩展名为.html的jinja2模板?例如,我希望视图配置看起来像,

@view_config(context=MyModel, renderer='templates/index.html')
def home_view(request):
...

Is it possible?

可能吗?

1 个解决方案

#1


17  

config.add_renderer('.html', 'pyramid_jinja2.renderer_factory')

#1


17  

config.add_renderer('.html', 'pyramid_jinja2.renderer_factory')