- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在我的 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 %}
然后你需要添加一个加载 block
{% load profiler_tags %}
我认为这就是所有更改,但需要检查我的 git 日志。
关于django - gae_mini_profiler {% profiler_includes %} 给出无效 block 标记 : 'profiler_includes' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8337262/
我在获取 https://github.com/Khan/gae_mini_profiler 时遇到问题在我的应用程序中正常工作。 我仔细遵循了说明,这是我的应用程序(删除了不必要的内容。) impo
我正在尝试在我的 django-nonrel 应用程序中安装 gae_mini_profiler 我将 {% profiler_includes %} 标签放在了我的 base.html 的底部 结果
我是一名优秀的程序员,十分优秀!