简体   繁体   中英

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?

{{ 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM