[英]Django. success_url in view or get_absolute_url() in model. How to use them right?
[英]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.