html - 是否可以使用 flask 执行包含?

标签 html templates flask jinja2 ssi

假设我在 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/

相关文章:

html - 粗体/斜体不适用于 Canvas fillText()

c# - WebBrowser OnPropertyChange 事件未触发

html - 如何删除此搜索框中的多余空间(输入字段和按钮之间)

c++ - g++ 模板错误 Small_size

python-3.x - 无法为 API 设置 DEFAULT_PARSERS 导入 flask_api.parsers.JSONParser

python - 线程 Flask 应用程序未按预期工作

html - :hover CSS selector (Angular) 的意外行为

c++ - 减少 C++ 中模板参数的重复

c++ - 需要有关在 C++ 中使用结构模板的帮助

javascript - 当且仅当在 FF/Chrome 中调试时,jQuery AJAX 调用才有效