While the web server that is included in Django is good for testing, for production use, it is recommended to use a web server like Apache with mod_wsgi.

Install apache2 and wsgi module.

sudo apt-get install apache2 libapache2-mod-wsgi

Dashboard includes a file django.wsgi(/opt/osdb/openstack-dashboard/dashboard/wsgi/django.wsgi) to help in running dashboard under Apache with WSGI. You can replace the default file with the file below.

# Ref: http://jmoiron.net/blog/deploying-django-mod-wsgi-virtualenv/

import sys
import site
import os

#we are adding virtual environment path.
vepath = '/opt/osdb/openstack-dashboard/.dashboard-venv/lib/python2.7/site-packages'
os.environ['PYTHON_EGG_CACHE'] = '/opt/osdb/openstack-dashboard/.dashboard-venv/lib/python2.7/site-packages'

prev_sys_path = list(sys.path)

# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)

# reorder sys.path so new directories from the addsitedir show up first

new_sys_path = [p for p in sys.path if p not in prev_sys_path]

for item in new_sys_path:
    sys.path.remove(item)
sys.path[:0] = new_sys_path

# import from down here to pull in possible virtualenv django install

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


loading table of contents...