summaryrefslogtreecommitdiffstats
path: root/reports/reports.wsgi
diff options
context:
space:
mode:
Diffstat (limited to 'reports/reports.wsgi')
-rw-r--r--reports/reports.wsgi25
1 files changed, 13 insertions, 12 deletions
diff --git a/reports/reports.wsgi b/reports/reports.wsgi
index 1a2a17f07..05f28e3c8 100644
--- a/reports/reports.wsgi
+++ b/reports/reports.wsgi
@@ -5,19 +5,20 @@ import django
config_parsed = False
-# 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
+def application(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
-if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
- from django.core.wsgi import get_wsgi_application
- application = get_wsgi_application()
-else:
- def application(environ, start_response):
+ if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
+ from django.core.wsgi import get_wsgi_application
+ return get_wsgi_application()(environ, start_response)
+ else:
import django.core.handlers.wsgi
return django.core.handlers.wsgi.WSGIHandler()(environ, start_response)