Reputation: 5453
I'm using Google App Engine for Python with Jinja2 templating. Is there a template tag to get the URL of the current page. Or do I have to pass the url as a variable to the template from the view code?
Upvotes: 3
Views: 5753
Reputation: 11370
{{ request.url }}
gives the current url. Do you need the full url, or just the path relative to the root?
For example, using Flask, you can have
{{ request.url }}
{{ request.base_url }}
{{ request.url_root }}
{{ request.host_url }}
{{ request.path }}
etc.
Upvotes: 12