summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/manage.py
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2015-10-01 19:58:20 -0500
committerSol Jerome <sol.jerome@gmail.com>2015-10-01 19:58:20 -0500
commit35a2ad1d76790b62b3dbb41cb7fa112c81dc4d5f (patch)
treea451a77147bc9fabce6e224e2038eedc78e27969 /src/lib/Bcfg2/manage.py
parent061bd6abbb598659554f28a1a5bba45fd6eca6da (diff)
parenta505fb3b2df0d1eddfe7a92afb080b016e951a43 (diff)
downloadbcfg2-35a2ad1d76790b62b3dbb41cb7fa112c81dc4d5f.tar.gz
bcfg2-35a2ad1d76790b62b3dbb41cb7fa112c81dc4d5f.tar.bz2
bcfg2-35a2ad1d76790b62b3dbb41cb7fa112c81dc4d5f.zip
Merge branch 'fix/django1.7' of https://github.com/AlexanderS/bcfg2
Diffstat (limited to 'src/lib/Bcfg2/manage.py')
-rwxr-xr-xsrc/lib/Bcfg2/manage.py29
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)