from apps.core.models.site_settings import SiteSettings


def get_true_host(request):
    '''
    request并不是用于http应用，而将http中的request变量传递过来
    '''
    site_config = SiteSettings.get_solo()
    if site_config.site_url:
        base_url = site_config.site_url
    else:
        # base_url = request.get_host(
        # )  # 考虑加上scheme (http/https) f'http://{request.get_host()}'
        base_url = request.build_absolute_uri('/')
    return base_url
