summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Core.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-10-30 10:02:38 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-10-30 12:54:24 -0400
commita8de10cde0b83743e8e453c8318cd1ab15e7c419 (patch)
treeef1749c586f5c6521de28ffe7a8674f045f2fc7a /src/lib/Bcfg2/Server/Core.py
parent1c5c4f285293142e38ff54797e1c4b5a820e9cb0 (diff)
downloadbcfg2-a8de10cde0b83743e8e453c8318cd1ab15e7c419.tar.gz
bcfg2-a8de10cde0b83743e8e453c8318cd1ab15e7c419.tar.bz2
bcfg2-a8de10cde0b83743e8e453c8318cd1ab15e7c419.zip
DB: fixed how Django settings are loaded
Diffstat (limited to 'src/lib/Bcfg2/Server/Core.py')
-rw-r--r--src/lib/Bcfg2/Server/Core.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index e3a9f7fce..9174878b2 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -14,7 +14,7 @@ import lxml.etree
import Bcfg2.Server
import Bcfg2.Logger
import Bcfg2.Options
-import Bcfg2.settings
+import Bcfg2.DBSettings
import Bcfg2.Server.Statistics
import Bcfg2.Server.FileMonitor
from itertools import chain
@@ -25,13 +25,19 @@ from Bcfg2.Server.Plugin.interfaces import * # pylint: disable=W0401,W0614
from Bcfg2.Server.Plugin import track_statistics
try:
+ from django.core.exceptions import ImproperlyConfigured
+ from django.core import management
+ import django.conf
+ HAS_DJANGO = True
+except ImportError:
+ HAS_DJANGO = False
+
+try:
import psyco
psyco.full()
except ImportError:
pass
-os.environ['DJANGO_SETTINGS_MODULE'] = 'Bcfg2.settings'
-
def exposed(func):
""" Decorator that sets the ``exposed`` attribute of a function to
@@ -198,10 +204,6 @@ class Core(object):
#: RLock to be held on writes to the backend db
self.db_write_lock = threading.RLock()
- # generate Django ORM settings. this must be done _before_ we
- # load plugins
- Bcfg2.settings.read_config()
-
# mapping of group name => plugin name to record where groups
# that are created by Connector plugins came from
self._dynamic_groups = dict()
@@ -232,9 +234,7 @@ class Core(object):
#: Whether or not it's possible to use the Django database
#: backend for plugins that have that capability
self._database_available = False
- if Bcfg2.settings.HAS_DJANGO:
- from django.core.exceptions import ImproperlyConfigured
- from django.core import management
+ if HAS_DJANGO:
try:
management.call_command("syncdb", interactive=False,
verbosity=0)
@@ -1343,7 +1343,7 @@ class NetworkCore(Core):
self.ca = Bcfg2.Options.setup.ca
if self._database_available:
- db_settings = Bcfg2.settings.DATABASES['default']
+ db_settings = django.conf.settings.DATABASES['default']
if (Bcfg2.Options.setup.daemon and
Bcfg2.Options.setup.daemon_uid and
db_settings['ENGINE'].endswith(".sqlite3") and