Commits

Flavio Curella  committed 45f0ed7

fixed ImproperlyConfigured when installing with django but no `DJANGO_SETTINGS_MODULE`

  • Participants
  • Parent commits ab6fd10
  • Branches packaging

Comments (0)

Files changed (1)

File timedelta/__init__.py

 __version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().strip()
 
 try:
+    from django.core.exceptions import ImproperlyConfigured
+except ImportError:
+    ImproperlyConfigured = None
+
+try:
     from .fields import TimedeltaField
     from .helpers import (
         divide, multiply, modulo, 
         percentage, decimal_percentage,
         total_seconds
     )
-except ImportError:
-    pass
+except (ImportError, ImproperlyConfigured):
+    pass