Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在django中获取视图的绝对url?_Python_Django - Fatal编程技术网

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

Python 如何在django中获取视图的绝对url?,python,django,Python,Django,我在views.py中有一个名为“callback”的视图。 如何获取该视图的域的绝对url 我尝试使用: request.build_absolute_url(reverse('authorize')) 但这并不奏效 我该怎么办?我相信这不是构建绝对url试试这个: request.get_host() + reverse('authorize')

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

我尝试使用:

request.build_absolute_url(reverse('authorize')) 
但这并不奏效

我该怎么办?

我相信这不是
构建绝对url
试试这个:

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