Using Flask Blueprints to Help Organize and Maintain Your Code Base
In this video we're going to look at a real Flask app and see how blueprints allow us to split up different sections of our code base.
Flask has this one feature called blueprints and they are a great way to help organize your code base. I use them in every Flask app I develop.
Below is an 11 minute video where we look at how I broke up a fairly large Flask application using blueprints. By the end of this video you’ll understand the advantages of using blueprints and be on your way to seeing how you can start using them in your applications.
# Reviewing Blueprints in a Real World Flask App
Timestamped Table of Contents
- 0:27 – Blueprints help you compartmentalize your code
- 0:54 – Looking at a 4,000+ line Flask app from my Flask course
- 1:54 – Taking a look at the app’s
blueprints/
folder - 2:23 – Trying to organize an app without blueprints
- 2:51 – You’ll be spending most of your time maintaining your code base
- 4:18 – Viewing a couple of blueprints to see what type of files they have
- 5:21 – Going through the process of finding specific code to modify
- 6:07 – Blueprints are helpful for finding code in the future
- 6:45 – Reviewing the
app.py
file to see how you use blueprints in your app factory - 8:02 – Using blueprints for a smaller Flask application
- 8:54 – Blueprints help you name space your URLs too
- 9:59 – Customizing other aspects of your blueprint
- 10:38 – Trying to learn Flask? Check out my Build a SAAS App with Flask course
Reference Links
- Build a SAAS App with Flask course
- https://github.com/nickjj/build-a-saas-app-with-flask
- https://github.com/nickjj/dotfiles
How are you using Flask blueprints in your projects? Let me know below.