Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: Course conclusion
Lecture: Layout pages
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
We saw that when we create our HTML page we've got a bunch of CSS, JavaScript other settings, meta tags, all that kind of stuff
0:10
maybe even navigation bars and footers. We want that shared across all the different pages. So instead of replicating it which would be a terrible idea
0:18
we saw that we can use the extends and create these blocks and fill them in. So we can create a Jinja2 template and we can say that our page template
0:28
extends this shared layout template. Remember how we organized our template files as well? We had a template folder
0:34
and then there're a folder for each view module that we're going to put together like account and packages and so on. Then we also had a shared one
0:42
and that's where we put our shared layout. You don't have to do that, but you know you probably should. It will really help you in the end.
0:48
So anyway, you definitely, definitely want to make sure that you use this share layout. It makes maintaining the site really much easier
0:54
and it's great. Definitely do it. Very easy in Flask.