summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/settings.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/settings.py')
-rw-r--r--src/lib/Bcfg2/settings.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/settings.py b/src/lib/Bcfg2/settings.py
index 5de590fec..c72ef0ebe 100644
--- a/src/lib/Bcfg2/settings.py
+++ b/src/lib/Bcfg2/settings.py
@@ -1,7 +1,12 @@
import sys
-import django
import Bcfg2.Options
+try:
+ import django
+ has_django = True
+except:
+ has_django = False
+
DATABASES = dict()
# Django < 1.2 compat
@@ -39,7 +44,7 @@ def read_config(cfile='/etc/bcfg2.conf', repo=None, quiet=False):
HOST=setup['db_host'],
PORT=setup['db_port'])
- if django.VERSION[0] == 1 and django.VERSION[1] < 2:
+ if has_django and django.VERSION[0] == 1 and django.VERSION[1] < 2:
DATABASE_ENGINE = setup['db_engine']
DATABASE_NAME = DATABASES['default']['NAME']
DATABASE_USER = DATABASES['default']['USER']
@@ -51,7 +56,7 @@ def read_config(cfile='/etc/bcfg2.conf', repo=None, quiet=False):
# this lets manage.py work in all cases
read_config(quiet=True)
-if django.VERSION[0] == 1 and django.VERSION[1] > 2:
+if has_django and django.VERSION[0] == 1 and django.VERSION[1] > 2:
TIME_ZONE = None
DEBUG = False