openstack-ansible-os_horizon/templates/horizon_django.wsgi.j2
Matt Thompson 7d01073884 Remove venv activation code
This commit uses the pattern established in [1] to remove the venv
activation code by using the correct venv Python interpreter instead.

Note that using python-path in openstack_dashboard.conf.j2 does not
achieve full isolation from the host's python installation as we'd hope
(the path will still include /usr/local/lib/python2.7/dist-packages and
/usr/lib/python2.7/dist-packages), but every attempt at using
python-home failed due to the venv interpreter not being able to find
argparse.  We will need to spend some additional cycles here trying to
solve this as locking the venv interpreter into its own site-packages
is the best solution long-term.

[1] https://review.openstack.org/#/c/273943/

Change-Id: I0fbb8b9b070d1a0ab5cd55abfcc6587a0cd8957d
2016-03-03 13:55:50 +00:00

15 lines
415 B
Django/Jinja

import logging
import os
import sys
from django.core.wsgi import get_wsgi_application
from django.conf import settings
# Add this file path to sys.path in order to import settings
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
sys.stdout = sys.stderr
DEBUG = False
application = get_wsgi_application()