'For a given request domain, find a match in our microsite configuration
and then assign it to the thread local in order to make it available
to the complete Django request processing'

def set_config_by_domain(self, domain):

    if ((not self.has_configuration_set()) or (not domain)):
        return
    microsite = Microsite.get_microsite_for_domain(domain)
    if (not microsite):
        try:
            microsite = Microsite.objects.get(key='default')
        except Microsite.DoesNotExist:
            pass
    if microsite:
        self._set_microsite_config_from_obj(microsite.site.domain, domain, microsite)
