0
votes

I'm using bitnami Django stack. WSGI works fine when not using virtualenv

However I installed virtualenv in root using sudo apt-get install and now WSGI does not work for virtualenv projects

my apache conf file is

Alias /static "/opt/bitnami/apps/live/lib/python2.7/site-packages/django/contrib/admin/static"

<Directory '/opt/bitnami/apps/live/lib/python2.7/site-packages/django/contrib'>
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
</Directory>

WSGIScriptAlias /search "/opt/bitnami/apps/run/live_cybrhome.wsgi"

<Directory '/opt/bitnami/apps/run'>
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
</Directory>

my wsgi file is

import os, sys
sys.path.append('/opt/bitnami/apps/live')
sys.path.append('/opt/bitnami/apps/live/cybrhome')
os.environ['DJANGO_SETTINGS_MODULE'] = 'cybrhome.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

The apache log is:

mod_wsgi (pid=4070): Exception occurred processing WSGI script '/opt/bitnami/apps/run/live_cybrhome.wsgi'.

Traceback (most recent call last):

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in call

self.load_middleware()

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/django/core/handlers/base.py", line 45, in load_middleware

mw_class = import_by_path(middleware_path)

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/django/utils/module_loading.py", line 31, in import_by_path

error_prefix, module_path, class_name))

ImproperlyConfigured: Module "django.contrib.auth.middleware" does not define a "SessionAuthenticationMiddleware" attribute/class

Any ideas?

1

1 Answers

1
votes

SessionAuthenticationMiddleware is new in Django 1.7. Presumably you have an older version of Django installed in your virtualenv.