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?
+2
A:
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).
John
2009-05-03 10:13:19
thanks, John. I am using the webapp framework, so I guess I have to provide the url as a variable to the template. Correct?
shanyu
2009-05-03 10:18:36
Correct. Django templates don't provide this sort of functionality.
Nick Johnson
2009-05-03 11:01:22
Yes, you'll have to provide it yourself.
John
2009-05-03 22:20:51