【问题标题】:How to adapt WSGI application by uri query params in Tornado?如何通过 Tornado 中的 uri 查询参数来适配 WSGI 应用程序?
【发布时间】:2016-03-02 10:56:37
【问题描述】:

我正在将 Tornado 4 与 werkzeug 调试工具一起使用,但 werkzeug 回溯的输出需要 uri localhost/?__debug__=True... 中的 css 和 js 文件。

我需要将带有?__debug__=True 的请求调整到 werkzeug 调试应用程序,但不知道如何处理。

Tornado 3 版本在这里:https://gist.github.com/kxxoling/00f5bb306b5a3398fa0d。但由于 API 更改,无法在 Tornado 4 上运行。

【问题讨论】:

    标签: python tornado wsgi werkzeug


    【解决方案1】:

    tornado.web.Application 不支持基于查询参数的路由。

    看起来您需要的是HTTPServerConnectionDelegate 的实现,它根据请求的URI 委托给ApplicationWSGIContainer。这是链接 gist 中使用的 __call__ 接口的替代品。

    【讨论】:

      猜你喜欢
      • 2012-04-14
      • 1970-01-01
      • 1970-01-01
      • 2012-05-30
      • 2011-01-21
      • 2015-09-08
      • 2016-11-06
      • 1970-01-01
      • 2016-01-20
      相关资源
      最近更新 更多