繁体   English   中英

如何在django中获取视图的绝对URL?

[英]how to get the absolute url of a view in django?

我在views.py中有一个名为“callback”的视图。 如何获取该视图的域的绝对URL?

我试过用:

request.build_absolute_url(reverse('authorize')) 

但那没用。

我该怎么办?

我相信它是build_absolute_uri而不是build_absolute_url

尝试这个:

request.get_host() + reverse('authorize')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM