summaryrefslogtreecommitdiffstats
path: root/reports/reports.wsgi
diff options
context:
space:
mode:
Diffstat (limited to 'reports/reports.wsgi')
-rw-r--r--reports/reports.wsgi15
1 files changed, 13 insertions, 2 deletions
diff --git a/reports/reports.wsgi b/reports/reports.wsgi
index c2a2be1ce..7113b3308 100644
--- a/reports/reports.wsgi
+++ b/reports/reports.wsgi
@@ -2,9 +2,20 @@ import os
import Bcfg2.Options
import Bcfg2.DBSettings
-Bcfg2.Options.get_parser().parse()
+config_parsed = False
import django.core.handlers.wsgi
+
def application(environ, start_response):
- return django.core.handlers.wsgi.WSGIHandler()(environ, start_response)
+ global config_parsed
+
+ # with wsgi, the environment isn't present in os.environ, but
+ # is passwd to the application function
+ if 'BCFG2_CONFIG_FILE' in environ:
+ os.environ['BCFG2_CONFIG_FILE'] = environ['BCFG2_CONFIG_FILE']
+ if not config_parsed:
+ Bcfg2.Options.get_parser().parse()
+ config_parsed = True
+
+ return django.core.handlers.wsgi.WSGIHandler()(environ, start_response)