0
0
Djangoframework~20 mins

Security checklist (manage.py check --deploy) in Django - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Django Security Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
1:30remaining
What does manage.py check --deploy do in Django?

When you run manage.py check --deploy in a Django project, what is the main purpose of this command?

AIt starts the Django development server with extra debugging enabled.
BIt runs a security-focused system check to identify potential deployment issues.
CIt automatically fixes all security issues found in the project settings.
DIt deletes all temporary files and caches before deployment.
Attempts:
2 left
💡 Hint

Think about what 'check' commands usually do and what '--deploy' might imply.

📝 Syntax
intermediate
1:30remaining
Which setting causes manage.py check --deploy to warn about missing HTTPS?

Given the following Django settings, which one will cause manage.py check --deploy to raise a warning about HTTPS security?

Django
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
SECURE_HSTS_SECONDS = 0
ASECURE_SSL_REDIRECT = False
BSESSION_COOKIE_SECURE = True
CCSRF_COOKIE_SECURE = True
DSECURE_HSTS_SECONDS = 3600
Attempts:
2 left
💡 Hint

Which setting controls redirecting HTTP to HTTPS?

🔧 Debug
advanced
2:00remaining
Why does manage.py check --deploy warn about DEBUG=True?

Consider a Django project with DEBUG = True in production. What is the reason manage.py check --deploy warns about this?

ABecause <code>DEBUG=True</code> prevents static files from loading.
BBecause <code>DEBUG=True</code> disables database migrations.
CBecause <code>DEBUG=True</code> automatically enables HTTPS.
DBecause <code>DEBUG=True</code> exposes detailed error pages that can leak sensitive information.
Attempts:
2 left
💡 Hint

Think about what happens when an error occurs and DEBUG is on.

state_output
advanced
1:30remaining
What is the effect of setting SECURE_HSTS_SECONDS to a positive value?

In Django settings, what happens when you set SECURE_HSTS_SECONDS to a positive integer like 3600?

AIt enables debug logging for HTTPS requests.
BDjango will redirect all HTTP requests to HTTPS immediately.
CBrowsers will remember to only use HTTPS for your site for the given number of seconds.
DIt disables CSRF protection for the specified time.
Attempts:
2 left
💡 Hint

Think about what HSTS means in web security.

🧠 Conceptual
expert
2:00remaining
Which setting prevents JavaScript from accessing cookies in Django?

To protect cookies from being accessed by JavaScript (helping prevent XSS attacks), which Django setting should be set to True?

ASESSION_COOKIE_HTTPONLY
BSESSION_COOKIE_SECURE
CCSRF_COOKIE_SECURE
DSECURE_SSL_REDIRECT
Attempts:
2 left
💡 Hint

Which cookie flag blocks JavaScript access?