Django - ImproperlyConfigured: Module "django.contrib.auth.middleware"

11 浏览
0 Comments

Django - ImproperlyConfigured: Module "django.contrib.auth.middleware"

我正在使用virtualenv尝试学习Django,但是在安装Django后,当我尝试访问默认的Django起始页时,浏览器显示以下错误:

服务器出错,请联系管理员。

在我运行服务器的终端窗口中显示以下错误:

ImproperlyConfigured: 模块"django.contrib.auth.middleware"没有定义"SessionAuthenticationMiddleware"属性/类。

如果有人能解释为什么我在virtualenv中会出现这个错误,我将不胜感激。在非virtualenv的设置中,我可以正确运行服务器。

以下是完整的堆栈跟踪:

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/jruecke/Python/JSON/lib/python2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/handlers/wsgi.py", line 187, in __call__
    self.load_middleware()
  File "/Users/jruecke/Python/JSON/lib/python2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/handlers/base.py", line 45, in load_middleware
    mw_class = import_by_path(middleware_path)
  File "/Users/jruecke/Python/JSON/lib/python2.7/site-packages/Django-1.6.5-py2.7.egg/django/utils/module_loading.py", line 31, in import_by_path
    error_prefix, module_path, class_name))
ImproperlyConfigured: 模块"django.contrib.auth.middleware"没有定义"SessionAuthenticationMiddleware"属性/类。
[16/Sep/2014 22:44:30] "GET / HTTP/1.1" 500 59
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/jruecke/Python/JSON/lib/python2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/handlers/wsgi.py", line 187, in __call__
    self.load_middleware()
  File "/Users/jruecke/Python/JSON/lib/python2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/handlers/base.py", line 45, in load_middleware
    mw_class = import_by_path(middleware_path)
  File "/Users/jruecke/Python/JSON/lib/python2.7/site-packages/Django-1.6.5-py2.7.egg/django/utils/module_loading.py", line 31, in import_by_path
    error_prefix, module_path, class_name))
ImproperlyConfigured: 模块"django.contrib.auth.middleware"没有定义"SessionAuthenticationMiddleware"属性/类。

0