When DEBUG = False in Django settings, which setting must list the domains the site may serve?
A
INSTALLED_APPS
B
STATIC_ROOT
C
ALLOWED_HOSTS
Correct answer
D
SECRET_KEY
Correct answer
C. ALLOWED_HOSTS
15 views
⚔️
Challenge a friend on Django
Same MCQs, timed, live leaderboard. Send the link on WhatsApp – no sign-up needed.
Create challenge
Explanation
With debug off, Django refuses requests whose Host header is not in ALLOWED_HOSTS , which protects against HTTP Host header attacks. Never run production with DEBUG = True.
Reference
Asked in: Python Developer Interviews, NTS
Doubts & discussionNot sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ
‹ Previous MCQ In Django, when does a QuerySet such as Book.objects.filter(author='Ali') actually query the database? Next MCQ › What does get_object_or_404(Product, pk=5) do if no matching product exists?