2013-09-24 3 views
0

나는 오픈 소스 장고 응용 프로그램 (OSQA)를 설치하려고 발생하지만 난이 오류를 얻을 :예외 처리 WSGI 스크립트

[Tue Sep 24 10:37:09 2013] [error] mod_wsgi (pid=82486): Exception occurred processing WSGI script '/home/fuiba/webapps/osqa/osqa.wsgi'. 
[Tue Sep 24 10:37:09 2013] [error] Traceback (most recent call last): 
[Tue Sep 24 10:37:09 2013] [error] File "/home/fuiba/webapps/osqa/lib/python2.7/django/core/handlers/wsgi.py", line 232, in __call__ 
[Tue Sep 24 10:37:09 2013] [error]  self.load_middleware() 
[Tue Sep 24 10:37:09 2013] [error] File "/home/fuiba/webapps/osqa/lib/python2.7/django/core/handlers/base.py", line 42, in load_middleware 
[Tue Sep 24 10:37:09 2013] [error]  raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e)) 
[Tue Sep 24 10:37:09 2013] [error] ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named base" 

이것은 내 osqa.wsgi : 에서

import os 
import sys 
sys.path.append('/home/fuiba/webapps/osqa/osqa') 

from django.core.handlers.wsgi import WSGIHandler 
os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings' 
application = WSGIHandler() 

아파치 .conf 나는 가지고있다 WSGIScriptAlias :

WSGISocketPrefix ${APACHE_RUN_DIR} 
WSGIPythonPath /home/fuiba/webapps/osqa:/home/fuiba/webapps/osqa/lib/python2.7 
WSGIScriptAlias//home/fuiba/webapps/osqa/osqa.wsgi 
아파치 폴더 ( /home/fuiba/webapps/osqa/apache2) 나는 이상한 이름을 가진 파일을 얻을에서 91,363,210

: $ {APACHE_RUN_DIR은}

이 무엇을 .47892.0.1.sock?

도움을 주시면 감사하겠습니다.
감사합니다.

답변

1

프로젝트와 아파치에 대한 일반적인 경로를 정의하여, 예를 들어이 사장님 WSGI를 다시 구성하려고

osqa.wsgi :

만 유지하십시오하여 http.conf에서

import os, sys 

#path to directory of the .wgsi file ('[directory]/') 
wsgi_dir = os.path.abspath(os.path.dirname(__file__)) 

# path to project root directory (osqa '/') 
project_dir = os.path.dirname(wsgi_dir) 

# add project directory to system's Path 
sys.path.append(project_dir) 
sys.path.append('/home/fuiba/webapps/osqa/osqa') 


os.environ['PYTHON_EGG_CACHE'] = '/home/fuiba/webapps/osqa/osqa/.python-egg' 
#add the setting.py file to your system's path 
project_settings = os.path.join(project_dir,'settings') 

#explicitly define the DJANGO_SETTINGS_MODULE 
os.environ['DJANGO_SETTINGS_MODULE'] ='osqa.settings' 

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

가상 호스트의 WSGIScriptAlias는 wsgi 파일에서 이미 정의 할 경로입니다.

WSGIScriptAlias//home/fuiba/webapps/osqa/osqa.wsgi 
WSGIScriptReloading On 
WSGIProcessGroup domain.com 
WSGIDaemonProcess domain.com user=user processes=10 threads=1 maximum-requests=500 

libapache2_mod_wsgi가 설치된 경우 제대로 작동합니다.