From fe2e0a3ddbe05e5eace11268ddf909ed386438d0 Mon Sep 17 00:00:00 2001 From: Jonas Jochmaring Date: Fri, 22 May 2015 15:29:02 +0200 Subject: 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 --- src/lib/Bcfg2/manage.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'src/lib/Bcfg2/manage.py') diff --git a/src/lib/Bcfg2/manage.py b/src/lib/Bcfg2/manage.py index 3e4eedc9f..f88233133 100755 --- a/src/lib/Bcfg2/manage.py +++ b/src/lib/Bcfg2/manage.py @@ -1,14 +1,23 @@ #!/usr/bin/env python -from django.core.management import execute_manager -import imp -try: - imp.find_module('settings') # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) - sys.exit(1) +import os +import sys +import django +import Bcfg2.Options +import Bcfg2.DBSettings -import settings +Bcfg2.Options.get_parser().parse() + +if django.VERSION[0] == 1 and django.VERSION[1] <= 6: + try: + imp.find_module('settings') # Assumed to be in the same directory. + except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__) + sys.exit(1) if __name__ == "__main__": - execute_manager(settings) + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + from django.core.management import execute_from_command_line + execute_from_command_line(sys.argv) + else: + execute_manager(settings) -- cgit v1.2.3-1-g7c22