Complete the code to add Django's built-in middleware for security.
MIDDLEWARE = [
'[1]',
]The SecurityMiddleware is Django's built-in middleware that helps with security enhancements.
Complete the code to include middleware that manages sessions.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'[1]',
]The SessionMiddleware manages user sessions in Django.
Fix the error in the middleware list by adding the correct middleware for CSRF protection.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'[1]',
]The CsrfViewMiddleware protects against Cross-Site Request Forgery attacks.
Fill both blanks to add middleware for common HTTP features and clickjacking protection.
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'[1]',
'[2]',
]CommonMiddleware handles common HTTP features like URL rewriting.XFrameOptionsMiddleware protects against clickjacking attacks.
Fill all three blanks to create a dictionary comprehension filtering middleware names that contain 'Security' and converting them to uppercase.
security_middleware = {name[1]: name[2] for name in MIDDLEWARE if 'Security' [3] name}not in instead of in, or wrong string methods.This comprehension creates a dictionary where keys and values are the uppercase middleware names containing 'Security'. The in operator checks substring presence.