getsentry/raven-python — pull request #244 by omarkhan (2013-01-16 14:25:42+00:00)
Title: Fix django logging handler circular import bug

c5d2d16d907b91695608766993eb3ae277edc9bb introduces a circular import bug when adding the sentry handler to django logging in settings.py, as per the sentry docs. Django tries to configure logging, which imports the sentry handler, which imports the django client, which imports models from the django sites framework - the circular import.

The bug causes this error:

Unable to configure handler 'sentry': 'module' object has no attribute 'django'

This patch simply defers the `django.contrib.sites` import until it is actually needed.