Python Flask Demo: Mostly using Jinja to "extend the layout" (use common HTML and CSS files)

Опубликовано: 06 Октябрь 2024
на канале: Thomas Blum
34
1

In this video we look at a Flask app that has routes leading to (and also passing data to) two HTML pages in the templates folder. What is different this time is that the HTML files use Jinja to refer to a base HTML file (layout.html) which they are said to extend. The common elements of the two pages (first.html and second.html) are extracted to layout.html (which in turn connects to a style sheet common.css in the static folder). The common layout.html file uses Jinja to specify places where the HTML files that extend layout.html will insert code and data to make the pages distinct.