Bird
0
0

Which of the following is the correct way to initialize a Flask extension using the extension initialization pattern?

easy📝 Syntax Q12 of 15
Flask - Middleware and Extensions
Which of the following is the correct way to initialize a Flask extension using the extension initialization pattern?
Aext.init_app(app)
Bext = Extension(app)
Cext = Extension(); ext.init_app(app)
Dapp = Flask(); ext = Extension(app); ext.init_app()
Step-by-Step Solution
Solution:
  1. Step 1: Create extension without app

    Extensions are first created without passing the app instance.
  2. Step 2: Call init_app(app) to bind

    After creation, call init_app() with the app to initialize the extension.
  3. Final Answer:

    ext = Extension(); ext.init_app(app) -> Option C
  4. Quick Check:

    Separate creation and init with app [OK]
Quick Trick: Create extension first, then call init_app(app) [OK]
Common Mistakes:
MISTAKES
  • Passing app to constructor directly
  • Calling init_app() without app argument
  • Calling init_app() before creating extension

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes