我收到了这个错误:
[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
答案 0 :(得分:0)
您在treeio.core.middleware.domain.DomainMiddleware
之前加入django.middleware.csrf.CsrfViewMiddleware
。 django.middleware.csrf.CsrfViewMiddleware
应位于treeio
答案 1 :(得分:0)
检查你的Django版本,treeio适用于Django 1.3。你可以改为1.3版本写作
sudo pip install Django==1.3
或者你可以使用virtualenv。