Complete the code to create a Flask extension instance.
from flask_sqlalchemy import SQLAlchemy db = [1]()
The extension instance is created by calling SQLAlchemy().
Complete the code to initialize the extension with the Flask app.
from flask import Flask app = Flask(__name__) db = SQLAlchemy() db.[1](app)
run_app or start_app which do not exist.init_app.The init_app method initializes the extension with the Flask app.
Fix the error in the extension initialization pattern by completing the blank.
from flask import Flask from flask_mail import Mail mail = Mail() app = Flask(__name__) [1] = app mail.init_app(app)
The variable app should be assigned to itself or used directly; assigning app to app is correct here to avoid errors.
Fill both blanks to complete the factory function initializing the extension.
from flask import Flask from flask_migrate import Migrate migrate = Migrate() def create_app(): app = Flask(__name__) migrate.[1](app, [2]) return app
start instead of init_app.The Migrate extension is initialized with init_app passing the Flask app and the database instance db.
Fill all three blanks to complete the extension initialization with app factory pattern.
from flask import Flask from flask_login import LoginManager login_manager = LoginManager() def create_app(): app = Flask(__name__) login_manager.[1](app) login_manager.login_view = '[2]' login_manager.login_message_category = '[3]' return app
init_app.The LoginManager is initialized with init_app. The login view is set to home and the message category to info for user feedback styling.