Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modify Django middleware settings to add a custom middleware
# Application definition
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
# Add the new middleware just after the default AuthenticationMiddleware that manages sessions and cookies
'AutomaticDjangoAuthentication.authentication_middleware.AutomaticUserLoginMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.