Changed core.db to give a friendlier error message if the DATABASE_ENGINE setting is invalid

git-svn-id: http://code.djangoproject.com/svn/django/trunk@160 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-07-17 20:03:24 +00:00
parent 272b217557
commit d4ddc06021
1 changed files with 5 additions and 1 deletions

View File

@ -15,7 +15,11 @@ let us do that.
from django.conf.settings import DATABASE_ENGINE
try:
dbmod = __import__('django.core.db.backends.%s' % DATABASE_ENGINE, '', '', [''])
except ImportError:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured, "Your DATABASE_ENGINE setting, %r, is invalid. Is it spelled correctly?" % DATABASE_ENGINE
DatabaseError = dbmod.DatabaseError
db = dbmod.DatabaseWrapper()