summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/manage.py
diff options
context:
space:
mode:
authorJonas Jochmaring <jjonas@mail.upb.de>2015-05-22 15:29:02 +0200
committerAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-09-23 19:28:57 +0200
commitfe2e0a3ddbe05e5eace11268ddf909ed386438d0 (patch)
tree2029a7903813eedff19bc232a3ec92246a64452a /src/lib/Bcfg2/manage.py
parent5b0a2d1ba24a210a66a91cc1755f4e24fd8a9b7f (diff)
downloadbcfg2-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 '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)