Python for the .NET developer 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
0:01 but having all of our view methods mixed in
0:03 with the app startup code in that app top UI
0:07 is kind of icky. I don't really like it.
0:08 I would much rather have a home
0:11 and contact us, view, file, and one that has
0:15 just to do with guitars, guitar lists
0:17 guitar details, and so on, and really break those up.
0:20 Flask in its first impression doesn't
0:23 really encourage that.
0:24 That app that you have to use for app.route
0:27 it's super hard to share.
0:28 You can do it, but it's really not super easy
0:31 to make that work.
0:32 So they added this thing called blueprints
0:35 and blueprints allow you to, in separate files
0:38 create a blueprint of the routes and layout
0:41 that you want for a set of view methods
0:43 and then register those back into the application.
0:47 So I strongly recommend that you check out blueprints
0:49 and use these to organize your application better.
0:52 We just didn't go into it because as you can tell
0:54 at this point, it's a really long chapter
0:55 we have the whole database chapter after this
0:57 which is still working in the same app
0:59 so I didn't want to kill you with Flask
1:01 but you should definitely use blueprints
1:02 if you really work with this.