How can I install OSQA with the openCSW software stack?
asked: 2014-02-25 by: cgrzemba
cgrzemba answers:
Packages witch needed:
CSWapache2
CSWap2modwsgi
CSWpy-html5lib
CSWpy-markdown
CSWpy-django
CSWpy-openid
CSWmysql5
CSWpython27
CSWpy-south
clone OSQA from github: git clone git@github.com:dzone/osqa.git
config Apache2 with WSGI: in httpd.conf:
LoadModule wsgi_module libexec/mod_wsgi-2.7.so
in httpd-vhosts.conf:
# Must not be inside a VirtualHost directive.
WSGIPythonHome /opt/csw
WSGIPythonOptimize 2
and there in the VirtualHost section
Alias /upfiles /var/www/www.opencsw.org/osqa/osqa/forum/upfiles
<Directory /var/www/www.opencsw.org/osqa/osqa/forum/upfiles>
Order allow,deny
Allow from all
Options +Indexes
</Directory>
# collides with the /m redirect
Alias /m /var/www/www.opencsw.org/osqa/osqa/forum/skins/
<Directory /var/www/www.opencsw.org/osqa/osqa/forum/skins>
Order allow,deny
Allow from all
Options +Indexes
</Directory>
Alias /admin_media /opt/csw/lib/python2.7/site-packages/django/contrib/admin/media
<Directory /opt/csw/lib/python2.7/site-packages/django/contrib/admin/media>
Order allow,deny
Allow from all
Options +Indexes
</Directory>
Redirect permanent /community/community /community
<Location /community>
Order allow,deny
Allow from all
# Trying to work around broken canonical links in OSQA.
# Order deny,allow
# Deny from all
# <IfModule python_module>
# # CSWpy-django is already in sys.path
# PythonPath "sys.path + ['/var/www/www.opencsw.org/osqa/osqa']"
# SetHandler python-program
# PythonHandler django.core.handlers.modpython
# SetEnv DJANGO_SETTINGS_MODULE settings
# PythonOption django.root /community
# PythonDebug Off
# PythonAutoReload Off
# </IfModule>
</Location>
<IfModule wsgi_module>
# See also the definition of WSGIPythonHome above!
WSGIDaemonProcess www.opencsw.org threads=15 maximum-requests=10000
WSGIProcessGroup www.opencsw.org
WSGIScriptAlias /community /var/www/www.opencsw.org/osqa/osqa/osqa.wsgi
</IfModule>
config wsgi.py (use wsgi.py.dist):
import os
import sys
sys.path.append('/var/www/www.example.org/osqa')
sys.path.append('/var/www/www.example.org/osqa/osqa')
# The first part of this module name should be identical to the directory name
# of the OSQA source. For instance, if the full path to OSQA is
# /home/osqa/osqa-server, then the DJANGO_SETTINGS_MODULE should have a value
# of 'osqa-server.settings'.
os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
config settings_local.py:
$ cp settings_local.py.dist settings_local.py
edit:
LOG_FILENAME = '/var/log/apache/www.example.org/osqa/django.osqa.log'
INTERNAL_IPS = ('127.0.0.1','172.16.1.123')
ALLOWED_HOSTS = ('www.example.org',)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbname',
'USER': 'osqa',
'PASSWORD': 'secret',
'HOST': 'localhost',
'PORT': '',
'CONN_MAX_AGE': 600,
}
}
TIME_ZONE = 'Europe/Berlin'
OSQA_DEFAULT_SKIN = 'yourskin'