Django E.408, E.409 and E.410 errors on runserver
In Django 2.2.3, activating middlewears in settings is done using the variable MIDDLEWARE
not MIDDLEWERE_CLASSES
, check the docs here.
So simply change the variable in your settings.py
from MIDDLEWARE_CLASSES
to MIDDLEWARE
.
Most likely this issue occurred due to creating a project with a global django
package that had was of version < 2, and then running manage.py runserver
with a virtualenv that has local django
>= 2
Rename variables in settings.py
, or add this:
MIDDLEWARE = MIDDLEWARE_CLASSES
to settings.py
because new Django triggers errors above based on checks like this:
if not _contains_subclass( 'django.contrib.auth.middleware.AuthenticationMiddleware', settings.MIDDLEWARE): errors.append(checks.Error( ...
Change setting.py as pic showsChange setting.py
# MIDDLEWARE_CLASSES = [MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', # 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',]
Also See: From CSDN