I am moving an application that uses django_cms from one server where everything works, with another and for the last 4 hours I have tried to find the cause of this error. Suggestions are very welcome!
mod_wsgi (pid=21972): Exception occurred within WSGI script '/var/www/vhosts/compdoctest.com/django/compdoc/django.wsgi'. Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 230, in __call__ self.load_middleware() File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 42, in load_middleware raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e)) ImproperlyConfigured: Error importing middleware cms.middleware.media: "No module named media"
The violation line is the last in the middleware list in settings.py
MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'cms.middleware.page.CurrentPageMiddleware', 'cms.middleware.user.CurrentUserMiddleware', 'cms.middleware.multilingual.MultilingualURLMiddleware', 'cms.middleware.media.PlaceholderMediaMiddleware', )
If I delete the final line, then the code continues and crashes later, saying that this element is required in the middleware.
I am using a slightly different version of django, 1.2.1 final on the old working server and 1.2.3 final on the new server.
All I tried:
- The same version of django_cms - 2.1.0 beta 3 -, which was used on the old server
- The latest version on github is 2.1.0.beta2-550 Entering cms, mptt, menu, publisher folders in
- app From python importing
- googled (I don't have the same problem as me)
- middleware file (no problem)
python discovery result:
python manage.py shell Python 2.5.2 (r252:60911, Jan 20 2010, 23:14:04) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> import cms.middleware.media >>> cms.middleware.media.__file__ '/var/www/vhosts/compdoctest.com/django/compdoc/cms/middleware/media.pyc' >>> from django.forms.widgets import Media >>> import cms.middleware.media >>>
django django-cms
PhoebeB
source share