更新时间:2022-05-11 04:58:27
使用方便的request.build_absolute_uri() 方法根据请求,将相对 url 传递给它,它会给你一个完整的.
Use handy request.build_absolute_uri() method on request, pass it the relative url and it'll give you full one.
默认情况下,返回的是 request.get_full_path()
的绝对 URL,但您可以将相对 URL 作为第一个参数传递给它,以将其转换为绝对 URL.
By default, the absolute URL for request.get_full_path()
is returned, but you can pass it a relative URL as the first argument to convert it to an absolute URL.