Recall & Review
beginner
Why should DEBUG be set to False in a Django production setup?
DEBUG should be False in production to avoid showing detailed error pages to users, which can expose sensitive information and security risks.
Click to reveal answer
beginner
What is the role of ALLOWED_HOSTS in Django's production settings?
ALLOWED_HOSTS defines which domain names the Django app can serve. It prevents HTTP Host header attacks by restricting requests to trusted hosts.
Click to reveal answer
intermediate
Why do we use a separate database or database settings in production compared to development?
Production databases are optimized for performance, security, and reliability, often using more robust systems than development setups which may use simpler databases.
Click to reveal answer
intermediate
How does static file handling differ in production versus development in Django?
In production, static files are collected and served by a dedicated web server or CDN for better performance, unlike development where Django serves them directly.
Click to reveal answer
beginner
Why is it important to configure secure settings like HTTPS and security middleware in production?
Secure settings protect user data and prevent attacks like man-in-the-middle, ensuring data is encrypted and requests are safe.
Click to reveal answer
What should the DEBUG setting be in a Django production environment?
✗ Incorrect
DEBUG must be False in production to avoid exposing sensitive error details.
What does ALLOWED_HOSTS protect against?
✗ Incorrect
ALLOWED_HOSTS restricts which hosts can serve the app, preventing Host header attacks.
How are static files typically served in production?
✗ Incorrect
Production uses web servers or CDNs for efficient static file delivery.
Why use a different database setup in production?
✗ Incorrect
Production databases are optimized for reliability, security, and speed.
Which of these is a key security practice in Django production?
✗ Incorrect
Security middleware helps protect the app from common attacks.
Explain why Django's production setup requires different settings than development.
Think about security, performance, and reliability differences.
You got /5 concepts.
Describe how static file handling changes from development to production in Django and why.
Consider how users access images, CSS, and JavaScript.
You got /4 concepts.