Python for .NET Developers Transcripts
Chapter: Web frameworks
Lecture: Refactoring the app with blueprints
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
I don't know how you felt about it but having all of our view methods mixed in with the app startup code in that app top UI
0:08
is kind of icky. I don't really like it. I would much rather have a home and contact us, view, file, and one that has
0:16
just to do with guitars, guitar lists guitar details, and so on, and really break those up. Flask in its first impression doesn't
0:24
really encourage that. That app that you have to use for app.route it's super hard to share. You can do it, but it's really not super easy
0:32
to make that work. So they added this thing called blueprints and blueprints allow you to, in separate files
0:39
create a blueprint of the routes and layout that you want for a set of view methods and then register those back into the application.
0:48
So I strongly recommend that you check out blueprints and use these to organize your application better.
0:53
We just didn't go into it because as you can tell at this point, it's a really long chapter we have the whole database chapter after this
0:58
which is still working in the same app so I didn't want to kill you with Flask but you should definitely use blueprints if you really work with this.