Bootstrap layout

Most of the applications in Flask follow a specific pattern to lay out templates. In this recipe, we will talk about the recommended way of structuring the layout of templates in a Flask application.

Getting ready

By default, Flask expects the templates to be placed inside a folder named templates at the application root level. If this folder is present, then Flask will automatically read the contents by making the contents of this folder available for use with the render_template() method, which we will use extensively throughout this book.

How to do it…

Let's demonstrate this with a small application. This application is very similar to the one we developed in Chapter 1, Flask Configurations. The first thing to do is add a new folder ...

Get Flask Framework Cookbook 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.