2

Templating with Jinja

This chapter will cover the basics of Jinja templating from the perspective of Flask. We will also learn how to design and develop applications with modular and extensible templates.

Information

If you have followed Flask or Jinja or this book’s previous editions, you might have noticed that, previously, this templating library was called Jinja2. The latest version of Jinja at the time of writing is version 3, and the authors/community have decided to call it just Jinja instead of confusingly continuing with Jinja2, Jinja3, and so on.

In Flask, we can write a complete web application without the need for a third-party templating engine. For example, have a look at the following code; this is a standalone, simple Hello ...

Get Flask Framework Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.