@classmethod
def find_for_request(cls, request):
    """
        Find a shared site associated with this HTTP request object. Raises
        Raises SharingSite.DoesNotExist if no appropriate sharing site exists.

        Uses request hostname and port to find matching sharing site.
        """
    try:
        hostname = request.get_host().split(':')[0]
    except KeyError:
        hostname = None
    try:
        port = request.get_port()
    except (AttributeError, KeyError):
        port = request.META.get('SERVER_PORT')
    return cls.objects.get(hostname=hostname, port=port)
