Key Concepts

Review core concepts you need to learn to master this subject

Flask Templates

Flask uses templates to expand the functionality of a web application while maintaining a simple and organized file structure. Templates are enabled using the Jinja2 template engine and allow data to be shared and processed before being turned in to content and sent back to the client.

Flask Templates
Lesson 1 of 2
  1. 1
    When you navigate through a website you may notice that many of the pages on the site have a similar look and feel. This aspect of a website can be achieved with the use of templates. In this les…
  2. 2
    Having routes return full web pages as strings is not a realistic way to build our site. Containing our HTML in files is the standard and more organized approach to structuring our web app. To wo…
  3. 3
    Instead of having an HTML file for each recipe, it would be a lot easier having one file for many recipes. Being able to pass data to template files is how we can begin to accomplish this goal. A…
  4. 4
    Now that we can use variables in our templates, let’s look at different ways we can perform actions on them. Filters are used by the template engine to act on template variables. To use them si…
  5. 5
    Including conditionals such as if and if/else statements in our templates allows us to control how data is handled. Let’s say we have a string variable passed to our template. When the variable …
  6. 6
    Repetitive tasks are standard in most computer applications and template rendering is no different. Creating lists, tables or a group of images are all repetitive tasks that can be solved using *fo…
  7. 7
    If you go to any website you may notice certain elements exist across different web pages. The navigation bar is a good example of a common page element. This is the banner at the top of most sit…
  8. 8
    Congratulations, this concludes the lesson on Flask templates. In this lesson we: - Created a file structure that works with the Jinja2 template engine - Rendered pages in our browser using files c…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo