0

I got this error:

[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"

I have Django 1.5.1 and Python 2.7.3. I am trying to install Tree.io.

Any suggest?

EDIT:

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",)

The SO: Ubuntu 12.04.2 LTS

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Darkering
  • 35
  • 7
  • Do you have `django.middleware.csrf.CsrfViewMiddleware` in your `MIDDLEWARE_CLASSES` in settings? – alecxe Apr 24 '13 at 14:14
  • Yes, I have django.middleware.csrf.CsrfViewMiddleware in my MIDDLEWARE_CLASSES; "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", ) – Darkering Apr 24 '13 at 22:01
  • Could you please include your 'MIDDLEWARE_CLASSES` to the answer? Btw, according to docs csrf middleware `should come before any view middleware that assume that CSRF attacks have been dealt with`. – alecxe Apr 25 '13 at 08:34
  • Thanks for your comment: I Edited the question and included MIDDLEWARE_CLASSES. – Darkering Apr 25 '13 at 13:54
  • did you try to put `django.middleware.csrf.CsrfViewMiddleware` as first item? – RickyA Apr 25 '13 at 14:31

2 Answers2

0

You include treeio.core.middleware.domain.DomainMiddleware before django.middleware.csrf.CsrfViewMiddleware. django.middleware.csrf.CsrfViewMiddleware should be in the list before treeio

RickyA
  • 15,465
  • 5
  • 71
  • 95
  • I changed the MIDDLEWARE_CLASSES to MIDDLEWARE_CLASSES = ( 'django.middleware.csrf.CsrfViewMiddleware', 'johnny.middleware.LocalStoreClearMiddleware', ...... ) But the problem is the same.. Thanks for your answer – Darkering Apr 25 '13 at 14:58
  • I put `django.middleware.csrf.CsrfViewMiddleware` first and the problem is the same. – Darkering Apr 26 '13 at 13:22
0

Check your Django version, treeio works with Django 1.3.You can change to 1.3 version writing

sudo pip install Django==1.3

Or you can work with virtualenv.

Osarez
  • 366
  • 1
  • 2
  • 10