0
0
Djangoframework~20 mins

Why settings configuration matters in Django - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Django Settings Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is DEBUG mode important in Django settings?
What happens when you set DEBUG = True in Django settings during development?
ADjango disables all error messages and logs nothing.
BDjango shows detailed error pages with debug information when errors occur.
CDjango automatically deploys the app to production servers.
DDjango encrypts all database connections by default.
Attempts:
2 left
💡 Hint
Think about what helps developers find problems easily.
component_behavior
intermediate
2:00remaining
Effect of ALLOWED_HOSTS in Django settings
What will happen if you set ALLOWED_HOSTS = [] in production?
ADjango will automatically add localhost to ALLOWED_HOSTS.
BDjango will accept requests from any host without restriction.
CDjango will reject all incoming requests with a 'Bad Request' error.
DDjango will redirect all requests to HTTPS.
Attempts:
2 left
💡 Hint
Think about security and which hosts Django trusts.
📝 Syntax
advanced
2:00remaining
Identify the correct way to configure DATABASES in Django settings
Which option correctly configures a PostgreSQL database in Django settings?
ADATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'mydb', 'USER': 'user', 'PASSWORD': 'pass', 'HOST': 'localhost', 'PORT': '5432' } }
BDATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'mydb', 'USER': 'user', 'PASSWORD': 'pass' } }
CDATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'mydb', 'USER': 'user', 'PASSWORD': 'pass' } }
DDATABASES = { 'default': { 'ENGINE': 'postgresql', 'NAME': 'mydb', 'USER': 'user', 'PASSWORD': 'pass' } }
Attempts:
2 left
💡 Hint
Check the exact engine string Django expects for PostgreSQL.
state_output
advanced
2:00remaining
What is the effect of STATIC_URL setting in Django?
If STATIC_URL = '/static/' is set, what URL will Django use to serve static files?
AStatic files will not be served at all.
BStatic files will be served from the root URL '/' only.
CDjango will serve static files from '/media/' URL.
DURLs starting with '/static/' will be used to serve static files.
Attempts:
2 left
💡 Hint
STATIC_URL defines the base URL path for static files.
🔧 Debug
expert
3:00remaining
Why does changing SECRET_KEY in production cause errors?
If you change SECRET_KEY in a running Django production app, what problem might occur?
AUser sessions and password reset tokens become invalid causing login failures.
BThe database connection will fail immediately.
CDjango will automatically generate a new SECRET_KEY and continue working.
DStatic files will stop loading on the website.
Attempts:
2 left
💡 Hint
SECRET_KEY is used to sign important data like sessions.