NotperlyConfigured:导入中间件django.middleware.user时出错

时间:2014-01-14 06:28:27

标签: django django-cms

我刚刚安装了pj install的django-cms,现在,当我尝试访问管理页面时,我得到了以下错误而没有运气使用其他解决方案解决这个问题(许多涉及更改路径变量)过去几个小时

Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/flup- 1.0.3.dev_20110405-        py2.6.egg/flup/server/fcgi_base.py", line 574, in run
protocolStatus, appStatus = self.server.handler(self)
  File "/usr/lib/python2.6/site-packages/flup-1.0.3.dev_20110405-py2.6.egg/flup/server/fcgi_base.py", line 1159, in handler
result = self.application(environ, start_response)
  File "/home/mcgillme/lib/python2.6.6/site-packages/Django-1.4.10-py2.6.egg/django/core/handlers/wsgi.py", line 219, in __call__
self.load_middleware()
  File "/home/mcgillme/lib/python2.6.6/site-packages/Django-1.4.10-py2.6.egg/django/core/handlers/base.py", line 47, in load_middleware
    raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
ImproperlyConfigured: Error importing middleware django.middleware.page: "No module named page"
Status: 500 Internal Server Error
Content-Type: text/html

我查看了其他解决方案,因此我检查了我的cms安装 - 文件夹中间件存在并包含 _init .py文件。

$ PATH和$ PYTHONPATH似乎也包括cms,因为,例如这有效:

Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cms
>>> import django.middleware
>>> import django.middleware.page
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named page
>>> 

除了缺少的路径还能做什么呢? django.middleware如何工作,但找不到django.middleware.page?

3 个答案:

答案 0 :(得分:0)

我查看1.2到1.7之间的每个django版本,但没有django.middleware.page,但它位于django-cms

使用cms.middleware.page

答案 1 :(得分:0)

您是否在settings.py?

中将cms添加到了INSTALLED_APPS环境变量中
INSTALLED_APPS = {
    'cms',
}

检查后,也许你可以再次运行此命令以确保它已安装:

python manage.py syncdb

答案 2 :(得分:0)

  1. 检查一下:Removed the MultilingualMiddleware

  2. 它说解决方案可能是:

  3.   

    从您的设置中删除cms.middleware.multilingual.MultilingualURLMiddleware。

         

    请确保django.middleware.locale.LocaleMiddleware在您的设置中,它位于SessionMiddleware之后。