我希望在 python/django 中获取完整的请求 url。我想知道什么包可以帮助我做到这一点。
例如,如果有人访问example.com/my-homepage,我想在python中捕获字符串'example.com/my-homepage'。
谢谢!
答案 0 :(得分:0)
host = request.build_absolute_uri()
答案 1 :(得分:0)
试试request.path
更多详情[此处] (https://docs.djangoproject.com/en/3.1/ref/request-response/#attributes)