Within a Django template, you can use HttpRequest.build_absolute_uri to generate the current page URI with the following code:

{{ request.build_absolute_uri }}

If you are using this URL for a social media link, such as Facebook, Twitter, or Google+, you can also add the urlencode function to encode the uri you are generating.

{{ request.build_absolute_uri|urlencode }}

Looking for a way to go from beginner to intermediate Django developer? Check out my book Django for Beginners.