diff --git a/django/db/utils.py b/django/db/utils.py
index 3f5b86e..5c4740f 100644
a
|
b
|
|
1 | 1 | import os |
2 | 2 | from threading import local |
| 3 | import pkgutil |
3 | 4 | |
4 | 5 | from django.conf import settings |
5 | 6 | from django.core.exceptions import ImproperlyConfigured |
… |
… |
def load_backend(backend_name):
|
25 | 26 | except ImportError, e_user: |
26 | 27 | # The database backend wasn't found. Display a helpful error message |
27 | 28 | # listing all possible (built-in) database backends. |
28 | | backend_dir = os.path.join(os.path.dirname(__file__), 'backends') |
29 | | try: |
30 | | available_backends = [f for f in os.listdir(backend_dir) |
31 | | if os.path.isdir(os.path.join(backend_dir, f)) |
32 | | and not f.startswith('.')] |
33 | | except EnvironmentError: |
34 | | available_backends = [] |
| 29 | backend_path = import_module('django.db.backends').__path__ |
| 30 | available_backends = [ name for loader, name, ispkg |
| 31 | in pkgutil.iter_modules(backend_path) |
| 32 | if ispkg ] |
35 | 33 | full_notation = backend_name.startswith('django.db.backends.') |
36 | 34 | if full_notation: |
37 | 35 | backend_name = backend_name[19:] # See #15621. |