'Returns the current ``Site`` based on the SITE_ID in the
project\'s settings. The ``Site`` object is cached the first
time it\'s retrieved from the database.'

def get_current(self):

    from django.conf import settings
    try:
        sid = settings.SITE_ID
    except AttributeError:
        from django.core.exceptions import ImproperlyConfigured
        raise ImproperlyConfigured(u'You\'re    using    the    Django    "sites    framework"    without    having    set    the    SITE_ID    setting.    Create    a    site    in    your    database    and    set    the    SITE_ID    setting    to    fix    this    error.')
    try:
        current_site = SITE_CACHE[sid]
    except KeyError:
        current_site = self.get(pk=sid)
        SITE_CACHE[sid] = current_site
    return current_site
