Jinja2

Jinja2 is a templating module written in Python. The essential ideas are:

There are advanced ideas like template inheritance that we'll get to later.

Templating

Flask comes with Jinja2 built-in, so templating is very easy. Here's the example from the reading:

Here it is in action http://cs.wellesley.edu:1942/overview

To run it, I'll go into the ex1 directory and run ex1.py

Note that Flask automatically looks in the templates subfolder of the app. This might be configurable, but I don't see any reason to do so.

Here is the templates folder.

We'll look at the templates and try to understand the templating language a bit.