liveBook · Manning

Templating language

As explained in The Well-Grounded Python Developer: How the pros use Python and Flask

A template language is a language for combining a document template with data to produce a completed output document.

A templating language combines a document template with data to produce completed output. In web applications, it keeps HTML in a separate template file while inserting dynamic values before the server delivers the page. section 6.4.3

A dynamic page with Jinja2

Flask passes the current time to index.html with render_template("index.html", now=datetime.now()). The template places that value inside <h1>Current time: {{now}}</h1>, producing browser-ready HTML.

How The Well-Grounded Python Developer: How the pros use Python and Flask covers it

How deep it goes
Defines placeholders, separate template files, and value substitution through a worked Flask example.
Examples
Uses a Python f-string, a Flask route, an index.html template, and a current-time heading.
What it assumes
Assumes basic Python functions and HTML while using f-string formatting to motivate templating.
What you can do after
Apply it via Flask and Jinja2 to render dynamic values inside browser-delivered HTML.
How it connects
Connects dynamic information, HTML, Flask, Python functions, and browser delivery.

Also explained in

Compare how 3 books explain templating language →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Python Developer: How the pros use Python and Flask. The section links point to the parts of the book it draws on.