equal
deleted
inserted
replaced
|
1 from django.conf import settings |
|
2 from django.core.exceptions import ImproperlyConfigured |
|
3 from django.utils.importlib import import_module |
|
4 |
|
5 geom_backend = getattr(settings, 'GEOMETRY_BACKEND', 'geos') |
|
6 |
|
7 try: |
|
8 module = import_module('.%s' % geom_backend, 'django.contrib.gis.geometry.backend') |
|
9 except ImportError, e: |
|
10 try: |
|
11 module = import_module(geom_backend) |
|
12 except ImportError, e_user: |
|
13 raise ImproperlyConfigured('Could not import user-defined GEOMETRY_BACKEND ' |
|
14 '"%s".' % geom_backend) |
|
15 |
|
16 try: |
|
17 Geometry = module.Geometry |
|
18 GeometryException = module.GeometryException |
|
19 except AttributeError: |
|
20 raise ImproperlyConfigured('Cannot import Geometry from the "%s" ' |
|
21 'geometry backend.' % geom_backend) |