显示Django Debug工具栏,但面板返回404

时间:2014-03-28 06:44:02

标签: django django-debug-toolbar

它在过去几天工作,但现在工具栏上的所有链接都只是#

<li class="djDebugPanelButton active">
<input type="checkbox" data-cookie="djdtSQLPanel" checked="checked" title="Disable for next and successive requests">
    <a href="#" title="SQL queries from 1 connection" class="SQLPanel">SQL<br><small>215 queries in 174.10ms</small></a>
</li>

我已经明确地设置了它,如下所示:http://django-debug-toolbar.readthedocs.org/en/1.0/installation.html#explicit-setup

我没有得到djdt命名空间问题,实际上我没有任何错误,除了404我试图查看其中一个面板.....

2 个答案:

答案 0 :(得分:11)

配售:

if settings.DEBUG:
    import debug_toolbar
    urlpatterns = patterns(
        '',
        url(r'^__debug__/', include(debug_toolbar.urls)),)

在所有其他网址为我做了伎俩之前。然后:

urlpatterns += patterns(...)

其他网址,例如django-cms

或者,如果您希望将debug_toolbar实施放在文件urlpatterns = patterns('', url...) + urlpatterns的末尾。

答案 1 :(得分:1)

原来问题是grunt代理。由于我正在为这个项目的部分工作角度,grunt正在提供角度的东西并代理django的东西。

proxies: [{
    context: ['/api', '/ngforms', '/account', '/static', '/admin', '/__debug__'],
    host: '<%= yeoman.pyhost %>',
    port: '<%= yeoman.pyport %>'
}],

我必须将/__debug__上下文添加到grunt代理中,以便DjDT实际上可以看到响应请求。

相关问题