Challenge - 5 Problems
Production Setup Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why is DEBUG set to False in production?
In Django, what is the main reason to set
DEBUG = False in a production environment?Attempts:
2 left
💡 Hint
Think about what information you want to keep private from users.
✗ Incorrect
Setting DEBUG = False stops Django from showing detailed error pages that can reveal sensitive data. This protects your app from exposing internal details to users.
❓ component_behavior
intermediate2:00remaining
Effect of ALLOWED_HOSTS in production
What happens if the
ALLOWED_HOSTS setting in Django is empty when running in production with DEBUG = False?Attempts:
2 left
💡 Hint
Consider what happens when a request comes from a host not listed in
ALLOWED_HOSTS.✗ Incorrect
When DEBUG is False, Django checks ALLOWED_HOSTS to prevent HTTP Host header attacks. If empty, it raises DisallowedHost error.
❓ lifecycle
advanced2:00remaining
Static files handling difference in production
In Django, why do we run
collectstatic during production setup but not usually in development?Attempts:
2 left
💡 Hint
Think about how static files like images and CSS are served differently in production.
✗ Incorrect
In production, static files are collected into a single directory so a web server like Nginx can serve them efficiently. Development server serves them automatically without collecting.
📝 Syntax
advanced2:00remaining
Correct way to configure database in production
Which of the following Django
DATABASES settings is correctly configured for a PostgreSQL production database?Attempts:
2 left
💡 Hint
Look for the correct engine and filled connection details for PostgreSQL.
✗ Incorrect
Option D correctly uses the PostgreSQL engine and provides all necessary connection details for production.
🔧 Debug
expert2:00remaining
Diagnosing a production error with static files
A Django app in production shows broken CSS and images. The developer forgot to run
collectstatic. What error or behavior will the browser most likely show?Attempts:
2 left
💡 Hint
Think about what happens when static files are missing on the server.
✗ Incorrect
If static files are not collected, the web server cannot find them, causing 404 errors when the browser requests CSS or images.