diff --git a/django/db/utils.py b/django/db/utils.py index 28afa6cd076..cb52e6e9ea4 100644 --- a/django/db/utils.py +++ b/django/db/utils.py @@ -120,8 +120,10 @@ def load_backend(backend_name): if backend_name not in ['django.db.backends.%s' % b for b in builtin_backends]: backend_reprs = map(repr, sorted(builtin_backends)) raise ImproperlyConfigured( - "%r isn't an available database backend.\n" - "Try using 'django.db.backends.XXX', where XXX is one of:\n" + "%r isn't an available database backend or couldn't be " + "imported. Check the above exception. To use one of the " + "built-in backends, use 'django.db.backends.XXX', where XXX " + "is one of:\n" " %s" % (backend_name, ", ".join(backend_reprs)) ) from e_user else: diff --git a/tests/db_utils/tests.py b/tests/db_utils/tests.py index 2a1cec03653..3ce8e82cd30 100644 --- a/tests/db_utils/tests.py +++ b/tests/db_utils/tests.py @@ -57,8 +57,9 @@ class LoadBackendTests(SimpleTestCase): def test_load_backend_invalid_name(self): msg = ( - "'foo' isn't an available database backend.\n" - "Try using 'django.db.backends.XXX', where XXX is one of:\n" + "'foo' isn't an available database backend or couldn't be " + "imported. Check the above exception. To use one of the built-in " + "backends, use 'django.db.backends.XXX', where XXX is one of:\n" " 'mysql', 'oracle', 'postgresql', 'sqlite3'" ) with self.assertRaisesMessage(ImproperlyConfigured, msg) as cm: