Skip to main content
Loading page…
Python Mastery
Chapter 32
Lesson 2 of 4
Templates with Jinja2
Contents
Notes
Tutor
Concept
How Jinja2 Fits Into Flask
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
47 min
9 activities
0 of 9 done
In this lesson
1
How Jinja2 Fits Into Flask
2
Variables, Loops, Conditionals, and Filters
3
Template Inheritance — DRY Layouts
4
url_for — Never Hard-Code URLs
5
Jinja2 Auto-Escaping Protects Against XSS
6
Which Jinja2 delimiter prints an expression?
7
Template Inheritance — Correct Order
8
Why use url_for Instead of Hard-Coded URLs?
9
Senior Lab: Build, Run, and Review Evidence
Objectives
Learner can call render_template to render an HTML file with context variables
Learner can use Jinja2 variables, for loops, if/else, and filters in templates
Learner can build reusable layouts with template inheritance (extends/block)
Learner can link static assets and generate URLs with url_for
Further reading
Flask documentation
Chapter 32 · Web Apps with Flask
Routes & the Dev Server
Templates with Jinja2
Forms, Sessions & Redirects
A Real Flask App
Previous: Routes & the Dev Server
Next: Forms, Sessions & Redirects