Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: Introducing the Flask framework
Lecture: What are microframeworks?
Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now it's time to dig into Flask. And let's just think a little bit about choosing a web framework and where Flask might live
0:08 on this spectrum of frameworks. In my mind, there's two ends going on here. On one end, we have what are called microframeworks.
0:16 Microframeworks let you choose exactly the set of libraries and packages you want to use and put them together
0:23 as you like, without the framework imposing how that works. So over here, I would put Flask here what kind of data access layer do you want?
0:32 Well, Flask doesn't care doesn't come with one and it doesn't impose any structure there. Maybe you want to go get SQLAlchemy
0:38 maybe you want to get MongoDBs through MongoEngine or maybe you want to do something entirely different, right? Flask doesn't have an opinion
0:45 or any implementation along those lines. The other end of the spectrum doesn't have a great term like microframeworks.
0:53 But what I'm calling these are building-block frameworks. And these are things like Django. With Django, you can create a website
1:01 create a project and you say Oh, I would like a whole back end where I can just edit the database fields kind of like Excel type of thing.
1:09 That's like a line in the configuration file boom, that's turned on. I want forums or something like this
1:14 I want to plug these big building block pieces together. That's really productive and great if that's what you want.
1:20 But if you don't like the way Django does database access well, sorry, Django does it that way, it's very opinionated.
1:28 Not to say you can't work your way around it or do something different but you're always going against the grain, right?
1:33 So Django helps you by giving you a bunch of steps and opinions, here's how you do it, here's the libraries, go which is sometimes okay and great.
1:42 But if you are the type of person that likes to pick just this library, and just that library and put things together the way you like
1:49 well, microframeworks are probably better for you. Now Flask is not the most micro of the microframeworks.
1:55 We have things like Bottle that live way out there that do very, very little at all. And then we have Pyramid
2:01 which is maybe a little bit towards Django a little bit less microframework but still well in this microframework side of the world.
2:09 So here's how Flask fits together with all of the others. And I think Flask is a great choice. I'm personally a big fan of the microframework style.
2:19 Makes me happy to be over on the left side of this graph generally speaking, but I know Django is also very popular. And speaking of popularity
2:27 Flask and Django are almost identical at the time of this recording with Flask actually growing in popularity relative to Django.
2:34 So I guess the world is about split 50/50 on which side of this graph they want to live on.