diff options
Diffstat (limited to 'src/lib/Bcfg2/manage.py')
-rwxr-xr-x | src/lib/Bcfg2/manage.py | 29 |
1 files changed, 19 insertions, 10 deletions
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) |