From 16cecc4539d538bd47054831888e90f2bd3b6109 Mon Sep 17 00:00:00 2001 From: Tim Laszlo Date: Fri, 21 Sep 2012 17:33:13 -0500 Subject: Web Reports: allow bcfg2.conf to be passed to the wsgi app This allows users to specify alternate config files in the apache config SetEnv BCFG2_CONFIG_FILE /path/to/bcfg2.conf WSGIScriptAlias /bcfg2 /path/to/reports.wsgi --- reports/reports.wsgi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'reports/reports.wsgi') diff --git a/reports/reports.wsgi b/reports/reports.wsgi index 235715854..92401d763 100644 --- a/reports/reports.wsgi +++ b/reports/reports.wsgi @@ -1,4 +1,9 @@ import os +import Bcfg2.settings os.environ['DJANGO_SETTINGS_MODULE'] = 'Bcfg2.settings' import django.core.handlers.wsgi -application = django.core.handlers.wsgi.WSGIHandler() + +def application(environ, start_response): + if 'BCFG2_CONFIG_FILE' in environ: + Bcfg2.settings.read_config(cfile=environ['BCFG2_CONFIG_FILE']) + return django.core.handlers.wsgi.WSGIHandler()(environ, start_response) -- cgit v1.2.3-1-g7c22