David Xia
David Xia

Reputation: 5453

How to get current url in Google App Engine python with jinja templating

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

Answers (1)

GAEfan
GAEfan

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

Related Questions