Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use inbulit django templatetags in google-app-engine

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?

like image 707
aatifh Avatar asked Nov 15 '22 15:11

aatifh


1 Answers

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.

like image 91
gae123 Avatar answered Apr 02 '23 21:04

gae123