假设我在 template.html 中保存了一个模板布局。此模板包括横幅、侧面导航、内容容器和页脚。我可以使用 flask 以这样的方式分解这些页面元素,以便我可以拥有 banner.html、sidenavigation.html 等文件,并在 template.html 中呈现这些不同的文件吗?
最佳答案
发件人:http://jinja.pocoo.org/docs/templates/#include
模板.html
{% include 'banner.html' %}
{% include 'sidenavigation.html' %}
{% include 'content.html' %}
{% include 'footer.html' %}
关于html - 是否可以使用 flask 执行包含?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9679038/