Complete the code to import the Flask class correctly.
from flask import [1] def create_app(): app = [1](__name__) return app
The Flask class must be imported with a capital 'F' as Flask to create the app instance.
Complete the code to define the application factory function name correctly.
def [1](): app = Flask(__name__) return app
The conventional name for the application factory function in Flask is create_app.
Fix the error in the code to register a blueprint inside the factory function.
def create_app(): app = Flask(__name__) from .views import main app.[1](main) return app
The correct method to add a blueprint to a Flask app is register_blueprint.
Fill both blanks to configure the app with a secret key and enable debug mode.
def create_app(): app = Flask(__name__) app.config['[1]'] = '[2]' app.config['DEBUG'] = True return app
The secret key is set with the config key SECRET_KEY. The value can be any secret string like 'mysecretkey'.
Fill all three blanks to create a dictionary comprehension that maps blueprint names to their url prefixes.
blueprints = {
'[1]': [2].url_prefix for [3] in app.blueprints.values()
}This comprehension creates a dictionary where each blueprint's name is the key and its url_prefix is the value. The variable iterating is commonly named 'bp'.