Flask Web Application
00:09 It also isn’t quite as prescriptive about the structure. One of the advantages of Flask is you can build web applications in very little code. Personally, I use Django when I’m starting out to use a large scale application and Flask when I’m trying to cobble together a proof of concept.
00:24 Now, that’s not to say you can’t do larger applications with Flask—plenty of people do. That just tends to be how I approach it myself. Flask is nowhere near as opinionated about file structure, so what I’m going to show you is the sample application called Flaskr from the documentation. That’s available here, if you want to take a look at it yourself.
00:43 Similar to Django, there’s the project structure at the top, and then a configuration directory inside of it that has the app pieces with the same name. This includes information about the database, and then your actual application pieces, as well as your templates and static files.
This is similar to Django, but these pieces are actually inside of the sub-folder, instead of inside of the project folder. On the right-hand side, you’ve got the
tests/ directory, your virtual environment, and then your configuration things like
01:13 So, what you can see here is this structure is sort of similar to our large application structure, and the Django structure—there’s sort of a hybrid of ideas from the two different places. Like Django, Flask is also very large.
01:26 There’s plenty of information out there at Real Python, and of course, you can go to the Flask website itself to dig in further. You can also find some good Flask boilerplate at GitHub from our Real Python tutorials, and the corresponding website that goes with it.
01:41 This can help you see some examples and how the pieces work together. Thanks for sticking with me so far. I’m just going to wrap up in the next lesson and talk about different variations on some of the topics so far and point you at other places to get more information.
Become a Member to join the conversation.