diff --git a/django/db/utils.py b/django/db/utils.py index 83e2452546..fe5d7944aa 100644 --- a/django/db/utils.py +++ b/django/db/utils.py @@ -95,11 +95,12 @@ class ConnectionRouter(object): try: module_name, klass_name = r.rsplit('.', 1) module = import_module(module_name) - router = getattr(module, klass_name)() except ImportError, e: raise ImproperlyConfigured('Error importing database router %s: "%s"' % (klass_name, e)) + try: + router = getattr(module, klass_name)() except AttributeError: - raise ImproperlyConfigured('Module "%s" does not define a "%s" database router' % (module, klass_name)) + raise ImproperlyConfigured('Module "%s" does not define a database router name "%s"' % (module, klass_name)) else: router = r self.routers.append(router)