后台登录不了并提示'WSGIRequest' object has no attribute 'user'
docker>Evan2017年9月26日 (二) 03:38的版本 (→See Also)
WARNINGS: ?: (1_7.W001) MIDDLEWARE_CLASSES is not set. HINT: Django 1.7 changed the global defaults for the MIDDLEWARE_CLASSES. django.contrib.sessions.middleware.SessionMiddleware, django.contrib.auth.middleware.AuthenticationMiddleware, and django.contrib.messages.middleware.MessageMiddleware were removed from the defaults. If your project needs these middleware then you should configure this setting.
My solution
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.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] 改为 MIDDLEWARE_CLASSES = [ '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', 'django.middleware.security.SecurityMiddleware', ] 其实就改了个列表名而已 MIDDLEWARE --> MIDDLEWARE_CLASSES ,我开始还搞错了 搞成了 元组 原因 是 以前的都是元组,而现在 完善了,都是列表 这个昨天说错了 我今天在cenots7 + django1.8 得出的也是元组呢,应该是我本地的kali出问题了 20170916am 还有就是以前 都是 MIDDLEWARE_CLASSES 为什么 今天变成了 MIDDLEWARE 呢