Bird
0
0

You wrote this snippet in your Django asgi.py file but get an error:

medium📝 Debug Q14 of 15
Django - Async Django
You wrote this snippet in your Django asgi.py file but get an error:
from django.core.asgi import get_asgi_application

application = get_wsgi_application()

What is the problem?
AYou imported get_asgi_application but called get_wsgi_application, causing a NameError.
BYou must import get_wsgi_application to use it.
CThe application variable name is incorrect.
DThere is no problem; this code works fine.
Step-by-Step Solution
Solution:
  1. Step 1: Check imports and function calls

    The code imports get_asgi_application but calls get_wsgi_application(), which is not imported.
  2. Step 2: Understand the error cause

    This mismatch causes a NameError because get_wsgi_application is undefined in this context.
  3. Final Answer:

    You imported get_asgi_application but called get_wsgi_application, causing a NameError. -> Option A
  4. Quick Check:

    Import and call must match [OK]
Quick Trick: Import and function call must match exactly [OK]
Common Mistakes:
MISTAKES
  • Calling a function not imported
  • Mixing ASGI and WSGI functions
  • Assuming variable name causes error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes