From the course: Flask Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Template blocks and base templates
From the course: Flask Essential Training
Template blocks and base templates
- [Instructor] We've dived a little bit into flask templates and how they can make our life easier, but one thing that we haven't talked about is how templates can extend from one another, meaning that you can have a base HTML file and have components from that shown on every single webpage. Now an awesome example of this is inside of our home.html, we have some code to list out any messages that have been flashed. It would be awesome to have this on every single page of the website, and so, extending templates would be a great way to do this. So to show you, I'm going to go ahead and create a new template file here, and I'm going to call this file base.html. Now there's nothing special about this name. It's typically used when you're having something in a website that's going to be used on every page. But this is sort of the building blocks to say anything that's inside of here we want on almost every page. Now you have the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.