Recall & Review
beginner
What is the Application Factory Pattern in Flask?
It is a way to create Flask app instances inside a function. This helps to configure the app dynamically and makes testing easier.
Click to reveal answer
beginner
Why use the Application Factory Pattern?
It allows creating multiple app instances with different settings, supports testing by creating fresh apps, and helps organize code better.
Click to reveal answer
intermediate
How do you define an application factory function in Flask?
You define a function (commonly called create_app) that creates and returns a Flask app instance. Inside, you configure the app and register extensions or blueprints.
Click to reveal answer
intermediate
What is the role of Blueprints in the Application Factory Pattern?
Blueprints help organize routes and views. They are registered inside the factory function to keep the app modular and clean.
Click to reveal answer
intermediate
How does the Application Factory Pattern improve testing in Flask?
It lets you create a fresh app instance for each test with custom settings, avoiding shared state and making tests independent.
Click to reveal answer
What does the Application Factory Pattern in Flask mainly help with?
✗ Incorrect
The pattern helps create app instances inside a function, allowing dynamic configuration and easier testing.
Where do you register Blueprints when using the Application Factory Pattern?
✗ Incorrect
Blueprints are registered inside the factory function to keep the app modular and organized.
What is a common name for the function that creates the Flask app in this pattern?
✗ Incorrect
The function is commonly named create_app by convention.
Which of these is NOT a benefit of the Application Factory Pattern?
✗ Incorrect
Creating database tables is not automatic with this pattern; it focuses on app creation and configuration.
How does the Application Factory Pattern affect app extensions like Flask-Login?
✗ Incorrect
Extensions are typically initialized and linked to the app inside the factory function.
Explain how to create a Flask app using the Application Factory Pattern and why it is useful.
Think about how you build and prepare the app inside a function instead of globally.
You got /5 concepts.
Describe the role of Blueprints in the Application Factory Pattern and how they help organize a Flask app.
Consider how you might organize different parts of a big project.
You got /4 concepts.