我正在尝试在我的
django-nonrel应用程序中安装gae_mini_profiler
我将{%profiler_includes%}标记放在base.html的底部
它导致了一个
Exception Type: TemplateSyntaxError
Exception Value: Invalid block tag: 'profiler_includes'
我放了
from gae_mini_profiler import profiler
application = profiler.ProfilerWSGIMiddleware(application)
在djangoppengine / main / __ init__.py的底部
我在https://github.com/kamens/gae_mini_profiler#start处遵循了所有其他说明
我究竟做错了什么?
最佳答案 我通过将gae_mini_profiler / templatetags.py更改为真正的模板标记库来解决这个问题.
为此,请创建一个名为templatetags的包,然后将templatetags.py模块移动(并重命名)为profiler_tags.py.
在profiler_tags.py中进行以下更改:
更改:
from google.appengine.ext import webapp
register = webapp.template.create_template_register()
至:
from django.template import Library
register = Library()
更改:
path = os.path.join(os.path.dirname(__file__), "templates/includes.html")
至:
path = os.path.join(os.path.dirname(__file__), "../templates/includes.html")
在您的设置文件中,将gae_mini_profiler添加到已安装的应用列表中.
删除所有引用
template.register_template_library('gae_mini_profiler.templatetags')
在模板中,只要有{%profiler_includes%},就需要添加一个加载块
{% load profiler_tags %}
我认为这是所有的变化,但需要去检查我的git日志.