WSGI的virtualenv中不工作 [英] wsgi for virtualenv not working
问题描述
我使用bitnami Django的堆栈。
WSGI不使用的virtualenv时正常工作
I'm using bitnami Django stack. WSGI works fine when not using virtualenv
不过,我使用安装的virtualenv根命令和apt-get安装
现在WSGI不适合的virtualenv项目的工作。
However I installed virtualenv in root using sudo apt-get install
and now WSGI does not work for virtualenv projects
我的Apache的conf文件为
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>
我WSGI文件是
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()
在Apache日志是:
The apache log is:
mod_wsgi的(PID = 4070):发生异常处理WSGI脚本
/opt/bitnami/apps/run/live_cybrhome.wsgi。
mod_wsgi (pid=4070): Exception occurred processing WSGI script '/opt/bitnami/apps/run/live_cybrhome.wsgi'.
回溯(最近通话最后一个):
Traceback (most recent call last):
文件
/opt/bitnami/apps/django/lib/python2.7/site-packages/django/core/handlers/wsgi.py
线187,在拨打
self.load_middleware()
self.load_middleware()
文件
/opt/bitnami/apps/django/lib/python2.7/site-packages/django/core/handlers/base.py
第45行,在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)
mw_class = import_by_path(middleware_path)
文件
/opt/bitnami/apps/django/lib/python2.7/site-packages/django/utils/module_loading.py
第31行,在import_by_path
File "/opt/bitnami/apps/django/lib/python2.7/site-packages/django/utils/module_loading.py", line 31, in import_by_path
错误_ preFIX,module_path中,CLASS_NAME))
error_prefix, module_path, class_name))
ImproperlyConfigured:模块django.contrib.auth.middleware不
定义一个SessionAuthenticationMiddleware属性/类
ImproperlyConfigured: Module "django.contrib.auth.middleware" does not define a "SessionAuthenticationMiddleware" attribute/class
任何想法?
推荐答案
SessionAuthenticationMiddleware是在Django 1.7新。 presumably你已经安装在你的virtualenv的Django的旧版本。
SessionAuthenticationMiddleware is new in Django 1.7. Presumably you have an older version of Django installed in your virtualenv.
这篇关于WSGI的virtualenv中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!