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)

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

Support Django being on the path but unused.
Support Django being on the path but unused.

  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')
+         host = getattr(settings, 'STATSD_HOST', 'localhost')
-     port = getattr(settings, 'STATSD_PORT', 8125)
+         port = getattr(settings, 'STATSD_PORT', 8125)
-     statsd = StatsClient(host, port)
+         statsd = StatsClient(host, port)
+     except ImportError:
+         statsd = None
  
Support Django being on the path but unused.
## Code Before:
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)

## Instruction:
Support Django being on the path but unused.
## Code After:
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
