shanyu
shanyu

Reputation: 9726

how to get the url of the current page in a GAE template

In Google App Engine, is there a tag or other mechanism to get the URL of the current page in a template or is it necessary to pass the url as a variable to the template from the python code?

Upvotes: 2

Views: 556

Answers (1)

John
John

Reputation: 15316

It depends how you are populating the templates. If you are using them outside of Django, then you have to populate them with the URL yourself. If you are using them in Django with the default configuration, you would have to populate them with the URL yourself. An alternative that would avoid you having to populate them yourself is to configure the DJANGO.CORE.CONTEXT_PROCESSORS.REQUEST context processor as described on this page and then access the appropriate part of the request object directly (e.g. request.path).

Upvotes: 3

Related Questions