标签:
Last Update : 8/12/2016 18时4分
?
?
运行python manage.py runserver时出现下面错误
Traceback (most recent call last):
? File "D:\Python27\lib\wsgiref\handlers.py", line 85, in run
??? self.result = application(self.environ, self.start_response)
? File "D:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 72, in __call__
??? return self.application(environ, start_response)
? File "D:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 236, in __call__
??? self.load_middleware()
? File "D:\Python27\lib\site-packages\django\core\handlers\base.py", line 57, in load_middleware
??? raise exceptions.ImproperlyConfigured(‘Middleware module "%s" does not define a "%s" class‘ % (mw_module, mw_classname))
ImproperlyConfigured: Middleware module "django.contrib.auth.middleware" does not define a "SessionAuthenticationMiddleware" class
SessionAuthenticationMiddleware 这个是1.7里新加的,把 django版本升级就可以解决这个问题
?
如何查看 django版本?
import django
django.VERSION
?
还有一个方法是在 settings.py里删除SessionAuthenticationMiddleware
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‘,
)
标签:
原文地址:http://www.cnblogs.com/2dogslife/p/5765987.html