1
有没有办法在烧瓶渲染的忍者模板中放置断点?也许可以让你在模板中的各个点检查模板可用的变量?我看到一个博客,说你可以在django https://opensourcehacker.com/2013/05/16/putting-breakpoints-to-html-templates-in-python/做到这一点希望有类似的烧瓶。烧瓶忍者模板中的断点
有没有办法在烧瓶渲染的忍者模板中放置断点?也许可以让你在模板中的各个点检查模板可用的变量?我看到一个博客,说你可以在django https://opensourcehacker.com/2013/05/16/putting-breakpoints-to-html-templates-in-python/做到这一点希望有类似的烧瓶。烧瓶忍者模板中的断点
瓶具有app_context_processor
做出模板可用变量:
context处理器运行模板呈现前必须注入新的值到模板方面的能力。
class Letters():
A = 1
B = 2
@app.context_processor
def share_context():
return dict(Letters=Letters)
Now you can access this class
# index.html
{{ Letters.A }}
{% if Letters.B != 1 %}
...
{% endif %}