Site Network:

Setting up Apache & mod_wsgi

If you are running Apache with the WSGI module, follow the instructions below to get Project HQ up and running. This setup presumes you've followed the installation instructions on setting up Project HQ in a virtual environment.

1. Create an application launch file

First create a file called index.wsgi in the same directory as your config.ini file. This directory should be both readable Apache. This file is used to run Project HQ.

#!/usr/bin/env python
import os
import sys

# Put the path to Project HQ here, something like /home/projecthq
app_path = '/path/to/projecthq'

sys.path.append(app_path)
os.environ['PYTHON_EGG_CACHE'] = '%s/egg-cache' % app_path

from paste.deploy import loadapp
_application = loadapp('config:%s/etc/config.ini' % app_path)

def application(environ, start_response):
environ['SCRIPT_NAME'] = ""
if not environ['PATH_INFO']:
environ['PATH_INFO'] = "/"
return _application(environ, start_response)

2. Edit Your vhost File

You don't need the "DocumentRoot" in your vhost file, so remove that, and add the following line, to show Apache where to run Project HQ from:

WSGIScriptAlias / /path/to/projecthq/etc/index.wsgi

We also need to tell mod_wsgi to use the virtual environment:

WSGIPythonHome /path/to/projecthq/venv

Your vhost file should look something like this:

WSGIPythonHome /path/to/projecthq/venv
<VirtualHost *:80>
ServerName projecthq.domain.com
WSGIScriptAlias / /path/to/projecthq/etc/index.wsgi
</VirtualHost>

Now reload Apache and Project HQ should be up and running.