Bird
0
0

Identify the issue in this async Flask route:

medium📝 Debug Q6 of 15
Flask - Ecosystem and Patterns
Identify the issue in this async Flask route:
from flask import Flask
app = Flask(__name__)

@app.route('/')
def home():
    await some_async_task()
    return 'Finished'
AMissing return statement
BUsing await inside a non-async function
CRoute decorator syntax is incorrect
DFlask app instance not created
Step-by-Step Solution
Solution:
  1. Step 1: Check function definition

    The function is defined with def, not async def.
  2. Step 2: Await usage

    Await can only be used inside async functions.
  3. Final Answer:

    Using await inside a non-async function -> Option B
  4. Quick Check:

    Await requires async def [OK]
Quick Trick: Await only inside async functions [OK]
Common Mistakes:
MISTAKES
  • Forgetting async keyword on route functions
  • Using await in synchronous functions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes