models.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:LatinSounds_AppEnviaMail 作者: G3ek-aR 项目源码 文件源码
def _get_site_by_request(self, request):
        host = request.get_host()
        try:
            # First attempt to look up the site by host with or without port.
            if host not in SITE_CACHE:
                SITE_CACHE[host] = self.get(domain__iexact=host)
            return SITE_CACHE[host]
        except Site.DoesNotExist:
            # Fallback to looking up site after stripping port from the host.
            domain, port = split_domain_port(host)
            if domain not in SITE_CACHE:
                SITE_CACHE[domain] = self.get(domain__iexact=domain)
            return SITE_CACHE[domain]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号