try:
    from django.conf import settings
except ImportError:
    settings = None

from client import StatsClient


__all__ = ['StatsClient', 'statsd', 'VERSION']

VERSION = (0, 1)


if settings:
    try:
        host = getattr(settings, 'STATSD_HOST', 'localhost')
        port = getattr(settings, 'STATSD_PORT', 8125)
        statsd = StatsClient(host, port)
    except ImportError:
        statsd = None

try:
    from django.conf import settings
except ImportError:
    settings = None

from client import StatsClient


__all__ = ['StatsClient', 'statsd', 'VERSION']

VERSION = (0, 1)


if settings:
    host = getattr(settings, 'STATSD_HOST', 'localhost')
    port = getattr(settings, 'STATSD_PORT', 8125)
    statsd = StatsClient(host, port)

--- 
+++ 
@@ -12,6 +12,9 @@
 
 
 if settings:
-    host = getattr(settings, 'STATSD_HOST', 'localhost')
-    port = getattr(settings, 'STATSD_PORT', 8125)
-    statsd = StatsClient(host, port)
+    try:
+        host = getattr(settings, 'STATSD_HOST', 'localhost')
+        port = getattr(settings, 'STATSD_PORT', 8125)
+        statsd = StatsClient(host, port)
+    except ImportError:
+        statsd = None
Support Django being on the path but unused.
