【问题标题】:Django Debug toolbar shows up, but the panels return 404显示 Django 调试工具栏,但面板返回 404
【发布时间】:2014-03-28 06:44:02
【问题描述】:

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

<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 .....

【问题讨论】:

    标签: django django-debug-toolbar


    【解决方案1】:

    放置:

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

    在所有其他 URL 对我有用之前。那么:

    urlpatterns += patterns(...)
    

    对于其余的 URL,例如 django-cms 等。

    或者,如果您更喜欢将 debug_toolbar 实现放在文件 urlpatterns = patterns('', url...) + urlpatterns 的末尾。

    【讨论】:

      【解决方案2】:

      原来问题出在 grunt 代理上。由于我正在为这个项目的某些部分使用 angular,grunt 正在提供 angular 的东西并代理 django 的东西。

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

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

      【讨论】:

      • 这很有趣。我遇到了同样的问题,但使用的是 nginx 代理。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-11
      • 1970-01-01
      • 2011-10-13
      • 1970-01-01
      • 2021-07-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多