Need to catch `ImproperlyConfigured` to be freed from the schackles of `DJANGO_SETTINGS_MODULE`.

This commit is contained in:
Justin Bronn 2012-10-05 14:38:01 -07:00
parent ab8c970368
commit 950e6183c6
2 changed files with 6 additions and 4 deletions

View File

@ -7,7 +7,7 @@ from ctypes import c_char_p, c_int, CDLL, CFUNCTYPE
from ctypes.util import find_library
from django.contrib.gis.gdal.error import OGRException
from django.core.exceptions import ImproperlyConfigured
logger = logging.getLogger('django.contrib.gis')
@ -15,7 +15,8 @@ logger = logging.getLogger('django.contrib.gis')
try:
from django.conf import settings
lib_path = settings.GDAL_LIBRARY_PATH
except (AttributeError, EnvironmentError, ImportError):
except (AttributeError, EnvironmentError,
ImportError, ImproperlyConfigured):
lib_path = None
if lib_path:

View File

@ -13,7 +13,7 @@ from ctypes import c_char_p, Structure, CDLL, CFUNCTYPE, POINTER
from ctypes.util import find_library
from django.contrib.gis.geos.error import GEOSException
from django.core.exceptions import ImproperlyConfigured
logger = logging.getLogger('django.contrib.gis')
@ -21,7 +21,8 @@ logger = logging.getLogger('django.contrib.gis')
try:
from django.conf import settings
lib_path = settings.GEOS_LIBRARY_PATH
except (AttributeError, EnvironmentError, ImportError):
except (AttributeError, EnvironmentError,
ImportError, ImproperlyConfigured):
lib_path = None
# Setting the appropriate names for the GEOS-C library.