How to Get Current URL in Django ?

Published On: 18/07/2022 | Category: Django Python

Hi Dev,

In this tute, we will discuss python django get current url example. you will learn python django url parameters. I would like to show you django get current url in view. if you want to see example of python django get urls then you are a right place.

So, In this example to get a current path and domain, path and query string in request to get a absolute url from request.

Let's see bellow example python django get urls.

To Get the Current Path:
{{ request.path }}
Current Path with Query String:
{{ request.get_full_path }}
Get Domain, Path and Query String:
{{ request.build_absolute_uri }}

I Hope It will help you....