diff options
author | Jonas Jochmaring <jjonas@mail.upb.de> | 2015-05-22 15:29:02 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2015-09-23 19:28:57 +0200 |
commit | fe2e0a3ddbe05e5eace11268ddf909ed386438d0 (patch) | |
tree | 2029a7903813eedff19bc232a3ec92246a64452a /reports/reports.wsgi | |
parent | 5b0a2d1ba24a210a66a91cc1755f4e24fd8a9b7f (diff) | |
download | bcfg2-fe2e0a3ddbe05e5eace11268ddf909ed386438d0.tar.gz bcfg2-fe2e0a3ddbe05e5eace11268ddf909ed386438d0.tar.bz2 bcfg2-fe2e0a3ddbe05e5eace11268ddf909ed386438d0.zip |
make Bcfg2-web compatible with django 1.7
- reports.wsgi uses get_wsgi_application() now
- old south-based migrations have been moved
- manage.py has been updated
Diffstat (limited to 'reports/reports.wsgi')
-rw-r--r-- | reports/reports.wsgi | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/reports/reports.wsgi b/reports/reports.wsgi index 7113b3308..1a2a17f07 100644 --- a/reports/reports.wsgi +++ b/reports/reports.wsgi @@ -1,21 +1,23 @@ import os import Bcfg2.Options import Bcfg2.DBSettings +import django config_parsed = False -import django.core.handlers.wsgi +# 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 - - return django.core.handlers.wsgi.WSGIHandler()(environ, start_response) +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): + import django.core.handlers.wsgi + return django.core.handlers.wsgi.WSGIHandler()(environ, start_response) |