Book Image

Learning Flask Framework

Book Image

Learning Flask Framework

Overview of this book

Table of Contents (17 chapters)
Learning Flask Framework
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a base template for the blog


Jinja2's inheritance and include features make it is very easy to define a base template that serves as the architectural foundation for each page on your site. The base template contains basic structural things that should never change, such as the <html>, <head>, and <body> tags, as well as the basic structure of the body. It can also be used to include style sheets or scripts that will be served on every page. Most importantly, the base template is responsible for defining overrideable blocks, into which we will place page-specific content such as the page title and body content.

In order to get up-and-running quickly, we will be using Twitter's Bootstrap library (version 3). This will allow us to focus on how templates are structured and have a decent-looking site with minimal extra work. You are, of course, welcome to use your own CSS if you prefer, but the example code will use bootstrap-specific constructs.

Create a new file in...