【问题标题】:Is there a way to render mako template from a string?有没有办法从字符串渲染 mako 模板?
【发布时间】:2012-04-28 20:50:55
【问题描述】:

我需要运行渲染存储在数据库中的字符串中的 mako 模板。代码应该是这样的

emailtext = render(template_string, {})

有没有办法在不创建临时.mako 文件的情况下这样做?

提前致谢,伊万。

【问题讨论】:

    标签: python pyramid mako


    【解决方案1】:

    当然,这是 Mako 文档中的第一个示例:http://docs.makotemplates.org/en/latest/usage.html#basic-usage

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-26
      • 2018-07-30
      • 2017-11-27
      • 2016-08-23
      • 1970-01-01
      • 2016-08-01
      • 2012-02-17
      • 1970-01-01
      相关资源
      最近更新 更多