0

我收到了这个错误:

[Mon Apr 22 23:45:42 2013] [error] [client 192.168.1.88] mod_wsgi (pid=19481): Exception occurred processing WSGI script '/home/projects/treeio/treeio.wsgi'.
[Mon Apr 22 23:45:42 2013] [error] [client 192.168.1.88] Traceback (most recent call last):
[Mon Apr 22 23:45:42 2013] [error] [client 192.168.1.88]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 236, in __call__
[Mon Apr 22 23:45:42 2013] [error] [client 192.168.1.88]     self.load_middleware()
[Mon Apr 22 23:45:42 2013] [error] [client 192.168.1.88]   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 53, in load_middleware
[Mon Apr 22 23:45:42 2013] [error] [client 192.168.1.88]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Mon Apr 22 23:45:42 2013] [error] [client 192.168.1.88] ImproperlyConfigured: Error importing middleware treeio.core.middleware.user: "No module named csrf.middleware"

我有 Django 1.5.1 和 Python 2.7.3。我正在尝试安装 Tree.io。

有什么建议吗?

编辑:

MIDDLEWARE_CLASSES = (
    'johnny.middleware.LocalStoreClearMiddleware',
    'johnny.middleware.QueryCacheMiddleware',
    'django.middleware.gzip.GZipMiddleware',
    'treeio.core.middleware.domain.DomainMiddleware',
    'treeio.core.middleware.user.SSLMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'treeio.core.middleware.user.AuthMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'treeio.core.middleware.chat.ChatAjaxMiddleware',
    "django.contrib.messages.middleware.MessageMiddleware",
    "treeio.core.middleware.modules.ModuleDetect",
    "minidetector.Middleware",
    "treeio.core.middleware.user.CommonMiddleware",
    "treeio.core.middleware.user.PopupMiddleware",
    "treeio.core.middleware.user.LanguageMiddleware",)

SO:Ubuntu 12.04.2 LTS

4

2 回答 2

0

你包括treeio.core.middleware.domain.DomainMiddleware之前django.middleware.csrf.CsrfViewMiddlewaredjango.middleware.csrf.CsrfViewMiddleware应该在列表之前treeio

于 2013-04-25T14:33:50.430 回答
0

检查你的 Django 版本,treeio 适用于 Django 1.3。你可以更改为 1.3 版本编写

sudo pip install Django==1.3

或者您可以使用 virtualenv。

于 2013-05-02T13:38:38.047 回答