How to get the full url in Python & Django

# How to get the full url in Python & Django:


import requests

Hostpath = request.get_full_path()

print(Hostpath)

EXAMPLE:

FULL_URL_WITH_QUERY_STRING: request.build_absolute_uri()

FULL_URL: request.build_absolute_uri('?')

ABSOLUTE_ROOT: request.build_absolute_uri('/')[:-1].strip("/")

ABSOLUTE_ROOT_URL: request.build_absolute_uri('/').strip("/")

Leave a Comment