1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Delayed settings.DATABASES usage by ConnectionHandler

Refs #20474.
This commit is contained in:
Claude Paroz
2013-05-21 11:35:05 +02:00
parent 499a745ae1
commit 2d8c132b18
2 changed files with 19 additions and 12 deletions

View File

@@ -2,7 +2,6 @@ import warnings
from django.conf import settings
from django.core import signals
from django.core.exceptions import ImproperlyConfigured
from django.db.utils import (DEFAULT_DB_ALIAS,
DataError, OperationalError, IntegrityError, InternalError,
ProgrammingError, NotSupportedError, DatabaseError,
@@ -13,11 +12,7 @@ from django.utils.functional import cached_property
__all__ = ('backend', 'connection', 'connections', 'router', 'DatabaseError',
'IntegrityError', 'DEFAULT_DB_ALIAS')
if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:
raise ImproperlyConfigured("You must define a '%s' database" % DEFAULT_DB_ALIAS)
connections = ConnectionHandler(settings.DATABASES)
connections = ConnectionHandler()
router = ConnectionRouter(settings.DATABASE_ROUTERS)