diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2012-09-21 17:33:13 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2012-09-21 17:36:20 -0500 |
commit | 16cecc4539d538bd47054831888e90f2bd3b6109 (patch) | |
tree | b54175335fa9557f9880380363bf62cc6e5250c1 | |
parent | fdb7a08f6f9bdd99449f118e20e1d38801a42fab (diff) | |
download | bcfg2-16cecc4539d538bd47054831888e90f2bd3b6109.tar.gz bcfg2-16cecc4539d538bd47054831888e90f2bd3b6109.tar.bz2 bcfg2-16cecc4539d538bd47054831888e90f2bd3b6109.zip |
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
-rw-r--r-- | reports/reports.wsgi | 7 |
1 files changed, 6 insertions, 1 deletions
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) |