Recall & Review
beginner
What does setting
DEBUG = True do in a Django project?It enables detailed error pages with debug information and auto-reloads the server on code changes. It should only be used during development.
Click to reveal answer
beginner
Why should
DEBUG be set to False in production?Because detailed error pages can expose sensitive information to users, which is a security risk. Also, performance is better with
DEBUG = False.Click to reveal answer
intermediate
What happens if
DEBUG = True but ALLOWED_HOSTS is not set correctly?Django will allow all hosts when
DEBUG = True, but in production with DEBUG = False, ALLOWED_HOSTS must list allowed domains to prevent host header attacks.Click to reveal answer
intermediate
How does
DEBUG = True affect static file serving in Django?When
DEBUG = True, Django automatically serves static files during development. When DEBUG = False, static files must be served by a web server or CDN.Click to reveal answer
intermediate
What is the impact of
DEBUG = True on database queries?Django logs detailed SQL queries and timing information in the debug toolbar or console, helping developers optimize queries during development.
Click to reveal answer
What is the main purpose of setting
DEBUG = True in Django?✗ Incorrect
DEBUG = True shows detailed error pages and reloads the server automatically to help developers during development.
What risk does leaving
DEBUG = True in production pose?✗ Incorrect
Detailed error pages can reveal sensitive data, which attackers could exploit.
When
DEBUG = False, what must be properly configured to avoid errors?✗ Incorrect
ALLOWED_HOSTS must list allowed domains to prevent host header attacks when DEBUG is False.
How does Django handle static files when
DEBUG = True?✗ Incorrect
Django serves static files automatically during development when DEBUG is True.
Which tool benefits from
DEBUG = True by showing SQL queries?✗ Incorrect
The Django Debug Toolbar shows detailed SQL queries and timings when DEBUG is True.
Explain what happens when you set
DEBUG = True in a Django project and why it is useful during development.Think about how developers find and fix errors quickly.
You got /4 concepts.
Describe the security and configuration considerations when switching
DEBUG from True to False in Django.Focus on what changes to keep the site safe and working.
You got /4 concepts.