阅读模板中的路径 [英] Reading path in templates
本文介绍了阅读模板中的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
干杯。
解决方案
使用请求上下文处理器启用,您可以使用 {{request.path}}
来获取所有的URL路径的模板。
is there any way to read the path to the current page? For example, I am at www.example.com/foo/bar/ - and I want to read '/foo/bar/'. I have to do this in the template file without modifying views, and I have too many view files to edit each one.
Cheers.
解决方案
With the request context processor enabled, you can use {{ request.path }}
to get the url path in all of your templates.
这篇关于阅读模板中的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文