上QQ阅读APP看书,第一时间看更新
Implementing block composition and layout inheritance
Usually, any web application will have a number of web pages that are different to each other. However, code blocks such as headers and footers will appear the same on almost all pages throughout the site; likewise, the menu will remain the same. In fact, it is usually just the center container block that changes. For this, Jinja2 provides a great way of ensuring inheritance among templates.
With this in mind, it's good practice to have a base template where the basic layout of the site, along with the header and footer, can be structured.