嘿,
我已经使用 Django 1.2.1 一段时间了,前几天遇到了 Django 调试工具栏。它看起来真的很有用,我真的很想尝试一些东西。
我完全按照自述文件所说的安装了。步步。我将中间件放在最后,以防万一出现问题,但我使用的是相当标准的中间件(common、sessions、auth 和 csrf)。但是,它不会显示在我的任何页面上。我尝试过移动中间件,但效果相同。
好像我安装了什么错误的东西。但是,当我加载 django 的管理部分时,工具栏就会弹出。我不确定我做错了什么。我的页面内容会影响出现的工具栏吗?它以 mime text/html 的形式输出...
无论如何,非常感谢任何帮助。提前致谢。
这是我的 Settings.py:pastebin.com/Hu8TgANt
Hey,
I've been using Django 1.2.1 for some time now and came across Django Debug Toolbar just the other day. It looks really useful and I'm really eager to try some stuff out.
I installed exactly how the readme said. Step by Step. I put the middleware at the end just in case things get caught up but I'm using quite standard middleware (common, sessions, auth and csrf). However, it won't show up on any of my pages. I've tried moving the middleware but to the same effect.
It seems as if I've installed something wrong. But, when I load up the Admin Section of django, the toolbar springs up. I'm not sure what I'm doing wrong. Can the content of my pages effect the toolbar coming up? It's outputting in the mime text/html...
Anyway, any help is greatly appreciated. Thanks in advance.
Here's my Settings.py: pastebin.com/Hu8TgANt
发布评论
评论(8)
调试工具栏要求响应 HTML 中至少有一个结束
标记。
来更改此标记
可以通过更改
settings.DEBUG_TOOLBAR_CONFIG['INSERT_BEFORE']
http://django-debug-toolbar.readthedocs.org/en/latest/configuration.html#toolbar-optionsDebug toolbar requires that there's at least a closing
</body>
tag in the response HTML.This tag can be changed by changing
settings.DEBUG_TOOLBAR_CONFIG['INSERT_BEFORE']
http://django-debug-toolbar.readthedocs.org/en/latest/configuration.html#toolbar-options
在不知道您的代码的情况下的一些提示:
错误应该在那里。我知道与在平面页面上显示工具栏相关的其他问题,因此如果您只在平面页面上检查,我建议您在另一个模块上尝试它。
A few tipps without knowing your code:
The error should be something in there. I know of other problems related getting the toolbar displayed on flatpages so if you only checked on flatpages I suggest you try it on another module.
我在这里遇到了同样的问题,最终到达了这篇文章...无论如何,就我而言,我注意到我的 js 包含库之一有一个 javascript 错误。这打破了 js 解释流程。当我修复了 javascript 错误后,django 工具栏就可以工作了。
这解释了为什么它在管理页面中有效,但在我的应用程序页面中无效。
I had the same problem here, and eventually arrived at this post... Anyway, in my case what I noticed was that I had a javascript error in one of my js included libraries. And that breaked the js interpretation flow. When I fixed the javascript error, the django toolbar worked.
That explains why it worked in the admin pages, but not in my app pages.
settings.py 中缺少 INTERNAL_IPS 键会影响工具栏的可见性。添加此内容可以解决问题:
Missing INTERNAL_IPS key in settings.py impacts toolbar visibility. Adding this resolves the issue:
就我而言,我使用 Google Material Design Lite 作为前端框架,
它具有样式定义,
该样式应用于调试工具栏的元素,导致不显示任何内容。
一个快速的解决方法是将 MDL 的样式定义(仅适用于本地样式表,不适用于托管的 cdn)更改为
In my case, I was using Google Material Design Lite as the frontend framework,
which has the style definition,
this style is applied to Debug Toolbar's elements which result in displaying nothing.
a quick workaround was to change the MDL's style definition (only possible on local stylesheets, not with cdn hosted) to
我有类似的问题。解决方案是将 div 作为非空 HTML 元素关闭。
从这里
到这里
希望有帮助!
I had a similar issue. The solution was closing a div as a non-empty HTML element.
From this
to this
Hope it helps!
就我而言,错误非常简单。
我删除了页脚,它的效果就像一个魅力!
希望这能为其他人解决问题。
In my case the error was very simple.
I removed the footer and it worked like a charm!
Hope this solves an issue for somebody else.
就我而言,解决方案是硬刷新我的网页。
只需按 Ctrl+F5 即可
In my case the solution was to hard-refresh my webpage.
Simply hit Ctrl+F5 and that's it