Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top