是否可以使用烧瓶执行包含? [英] Is it possible to perform Includes with flask?

查看:32
本文介绍了是否可以使用烧瓶执行包含?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个模板布局保存在 template.html 中.此模板包括横幅、侧边导航、内容容器和页脚.我可以使用flask 以这样的方式分解这些页面元素,以便我可以拥有banner.html、sidenavigation.html 等文件并在template.html 中呈现这些不同的文件吗?

Say I have a template layout saved in template.html. This template includes a banner, side navigation, content container, and footer. Can I use flask to break up these page elements in such a way that I can have files such as banner.html, sidenavigation.html, etc. and render these different files within template.html?

推荐答案

来自:http://jinja.pocoo.org/docs/templates/#include

模板.html

{% include 'banner.html' %}
{% include 'sidenavigation.html' %}
{% include 'content.html' %}
{% include 'footer.html' %}

这篇关于是否可以使用烧瓶执行包含?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆