问题
In my app.yaml file I have:
- name: django
version: "1.5"
which I assume means, use Django 1.5. 1.5 includes the verbatim tag, but when I try to use it I get:
TemplateSyntaxError: 'verbatim' is not a valid tag library: Template library verbatim not found, tried google.appengine._internal.django.templatetags.verbatim
Any idea how to enable this feature or is it just not included with app engine, I am using 1.8.9. Thanks!
回答1:
I don't think it works. When I tried to do this, I got this traceback:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
...
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\_internal\django\template\__init__.py", line 333, in invalid_block_tag
raise self.error(token, "Invalid block tag: '%s'" % command)
TemplateSyntaxError: Invalid block tag: 'verbatim'
Looking at the source C:\Program Files (x86)\Google\google_appengine\google\appengine\_internal\django\__init__.py you can see the version number in the first line:
VERSION = (1, 2, 5, 'final', 0)
This tells me that the appengine is using Django version 1.2.5 for the templating. I do not know if these means you can deploy the app to production and it will somehow use 1.5, but I couldn't get it to work locally. (Note that this was specifying Django 1.5 and Webapp 2.5.2 in my app.yaml using the Google App Engine Launcher 1.9.17)
来源:https://stackoverflow.com/questions/21642321/can-you-use-the-verbatim-tag-with-django-1-5-on-app-engine