In this lesson, you'll learn what templating tools are and how to work with them.
Why do we need templating tools?
First, let's look at this example code:
@app.route('/')
def root():
return 'Main page'
In this example, the handler will respond with the string 'Main Page'
. This example is for demonstration purposes, but usually, the browser expects an HTML page. And the page can be tens or hundreds of kilobytes. Now let's try to create HTML this way:
@app.route('/')
def root():
title = 'My super site'