#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    64
    Rep Power
    5

    Getting a "No module named multilingual" when running a Django app in Apache


    I am running a Django app through Apache. When I try and access my webpage, I get a 500 error. When I look at my Apache error logs, I have this error:

    Code:
    ImproperlyConfigured: Error importing middleware cms.middleware.multilingual: "No module named multilingual"
    Here is the stack trace:

    Code:
        mod_wsgi (pid=9244): Exception occurred processing WSGI script '/opt/bitnami/apps/django/scripts/django.wsgi'.
         Traceback (most recent call last):
           File "/opt/bitnami/apps/django/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__
             self.load_middleware()
           File "/opt/bitnami/apps/django/lib/python2.7/site-packages/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 cms.middleware.multilingual: "No module named multilingual"
         mod_wsgi (pid=9243): Exception occurred processing WSGI script '/opt/bitnami/apps/django/scripts/django.wsgi'.
         Traceback (most recent call last):
           File "/opt/bitnami/apps/django/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__
             self.load_middleware()
           File "/opt/bitnami/apps/django/lib/python2.7/site-packages/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 cms.middleware.multilingual: "No module named multilingual"
    When I do:
    Code:
    python manage.py runserver
    I do not get this error.

    Here's where the `multilingual` module is being imported in the `settings.py` file:
    Code:
        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.multilingual.MultilingualURLMiddleware',
            'cms.middleware.page.CurrentPageMiddleware',
            'cms.middleware.user.CurrentUserMiddleware',
            'cms.middleware.toolbar.ToolbarMiddleware',
            # Uncomment the next line for simple clickjacking protection:
            'django.middleware.clickjacking.XFrameOptionsMiddleware',
        )
    In the Python interpreter, I get this:
    Code:
        Python 2.7.3 (default, Feb 22 2013, 04:51:21) 
        [GCC 3.4.6] on linux2
        Type "help", "copyright", "credits" or "license" for more information.
        >>> import multilingual
        >>> multilingual.__file__
        '/opt/bitnami/python/lib/python2.7/site-packages/multilingual/__init__.pyc'
        >>>
    I am using Django 1.4.4. How do I fix this?
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,841
    Rep Power
    480
    Try

    $ python
    >>> import cms.middleware.multilingual


    The message says "improperly configured". Read the instructions and reinstall django and apache.

    Disclaimer: I've never used django in my programs.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo