So I have beating my head against the wall on this. I feel like I have interpretted the docs and examples I found, but this just won't seem to go away.
Here is the tag code:
from google.appengine.ext import webapp register = webapp.template.create_template_register() def test_tag(): return "TEST!" register.simple_tag(test_tag) Here is the main code:
from google.appengine.ext import webapp from google.appengine.ext.webapp import util, template webapp.template.register_template_library('my_tags') class MainHandler(webapp.RequestHandler): def get(self): self.response.out.write(template.render("test.html", {})) def main(): application = webapp.WSGIApplication([('/', MainHandler)], debug=True) util.run_wsgi_app(application) if __name__ == '__main__': main() Here is the template:
{% load my_tags %} <html>{% test_tag %}></html> Here is the error:
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django/django/template/defaulttags.py", line 750, in load raise TemplateSyntaxError, "'%s' is not a valid tag library: %s" % (taglib, e) TemplateSyntaxError: 'my_tags' is not a valid tag library: Could not load template library from django.templatetags.my_tags, No module named my_tags I really hate to flat out ask someone to fix my code, but I cannot seem to figure out why this won't work. Any hints or pointers would be greatly apprecated.
jc