如何在google-app-engine中使用inbulit django templatetags [英] How to use inbulit django templatetags in google-app-engine
问题描述
的人性化,但它不起作用。
我在INSTALLED_APPS中添加了标记和人性化。还是行不通。
如何使用?
这里是如何做到人性化的,别人应该是类似的。在调用模板的控制器的末尾有一个如下功能:
def main():
run_wsgi_app(application)
在def main()之后添加以下两行:
from google.appengine.ext.webapp import template
template.register_template_library(
'django.contrib.humanize.templatetags .humanize')
无需在模板中添加{%load humanize%}。
感谢这个帖子 http://blog.yjl.im/2011/02/few-things-on-google-app-engine-i.html 暗示了我的解决方案。
I am trying to use Django in built templatetags like markup and humanize in my google app , but its not working. I added markup and humanize in the INSTALLED_APPS. Still not working. How to use that?
Here is how to do it for humanize, others should be similar. At the end of the controller that invokes your template there is a function that looks like:
def main():
run_wsgi_app(application)
Add the following two lines just after def main():
from google.appengine.ext.webapp import template
template.register_template_library(
'django.contrib.humanize.templatetags.humanize')
No need to add {% load humanize %} in your template.
Thanks to this posting http://blog.yjl.im/2011/02/few-things-on-google-app-engine-i.html that hinted the solution for me.
这篇关于如何在google-app-engine中使用inbulit django templatetags的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!