Bird
0
0

Why is it recommended to use environment variables for sensitive settings in Django?

easy📝 Conceptual Q1 of 15
Django - Deployment and Production
Why is it recommended to use environment variables for sensitive settings in Django?
ATo reduce the size of the settings file
BTo keep sensitive data out of the codebase and version control
CTo allow users to change settings from the browser
DTo make the code run faster
Step-by-Step Solution
Solution:
  1. Step 1: Understand security best practices

    Sensitive data like passwords or keys should not be hardcoded to avoid leaks.
  2. Step 2: Role of environment variables

    Environment variables keep secrets outside the code and prevent accidental exposure.
  3. Final Answer:

    To keep sensitive data out of the codebase and version control -> Option B
  4. Quick Check:

    Security best practice = D [OK]
Quick Trick: Keep secrets outside code to protect them [OK]
Common Mistakes:
MISTAKES
  • Thinking environment variables speed up code
  • Believing users can change settings via browser
  • Assuming smaller settings file improves security

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes