How do you debug Mako templates?

后端 未结 6 1775
星月不相逢
星月不相逢 2021-01-30 21:15

So far I\'ve found it impossible to produce usable tracebacks when Mako templates aren\'t coded correctly.

Is there any way to debug templates besides iterating for ever

6条回答
  •  没有蜡笔的小新
    2021-01-30 21:54

    Looking at the Flask-Mako source, I found an undocumented configuration parameter called MAKO_TRANSLATE_EXCEPTIONS.

    Set this to False in your Flask app config and you'll get nice exceptions bubbling up from the template. This accomplishes the same thing as @Mariano suggested, without needing to edit the source. Apparently, this parameter was added after Mariano's answer.

提交回复
热议问题