0

I am trying to install an open-source Django application (OSQA) but i get this error:

[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"

This is my 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()

In httpd.conf i have WSGIScriptAlias:

WSGISocketPrefix ${APACHE_RUN_DIR}
WSGIPythonPath /home/fuiba/webapps/osqa:/home/fuiba/webapps/osqa/lib/python2.7  
WSGIScriptAlias / /home/fuiba/webapps/osqa/osqa.wsgi

In apache2 folder (/home/fuiba/webapps/osqa/apache2) i get a file with strange name: ${APACHE_RUN_DIR}.47892.0.1.sock

What is it?

Any help is appreciated.
Thank you!

1 Answer 1

1

try to reconfigure the WSGI lik this for example by defining a general path for the project and apache

osqa.wsgi :

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()

in the http.conf :

keep only the WSGIScriptAlias in the virtualhost, the path going to be already define in the wsgi file

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

it should work if libapache2_mod_wsgi is installed too

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.