0
0
Djangoframework~5 mins

DEBUG mode behavior in Django - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AImprove production server performance
BShow detailed error pages and auto-reload during development
CDisable error messages
DEnable database backups
What risk does leaving DEBUG = True in production pose?
APrevents database connections
BSlows down the server
CDisables static files
DExposes sensitive information to users
When DEBUG = False, what must be properly configured to avoid errors?
AINSTALLED_APPS
BDATABASES
CALLOWED_HOSTS
DSTATIC_URL
How does Django handle static files when DEBUG = True?
ADjango serves static files automatically
BStatic files must be served by a web server
CStatic files are disabled
DStatic files are compressed
Which tool benefits from DEBUG = True by showing SQL queries?
ADjango Debug Toolbar
BDjango Admin
CDjango ORM
DDjango Migrations
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.