如何使Bottle在通过apache modwsgi运行时打印堆栈跟踪?[英] How to make Bottle print stacktrace when running through apache modwsgi?

本文是小编为大家收集整理的关于如何使Bottle在通过apache modwsgi运行时打印堆栈跟踪?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

当瓶子作为独立服务器运行时,很容易做到:

from bottle import run, Bottle

run(app=app, host=config.get('bottle_host', 'localhost'), port=config.get('bottle_port', '8080'),
                            debug=config.get('debug', True), server=config.get('server_middleware', 'tornado'))

问题是,对于WSGI,我必须这样做:

app = Bottle()

和Bottle构造函数没有任何调试参数.那我该怎么做才能获得堆栈?

推荐答案

import bottle
bottle.debug(True)

如果您查看源,则可以看到此功能在提供run debug>.

时由run函数调用

本文地址:https://www.itbaoku.cn/post/1633003.html

问题描述

When running Bottle as a standalone server it's very easy to do:

from bottle import run, Bottle

run(app=app, host=config.get('bottle_host', 'localhost'), port=config.get('bottle_port', '8080'),
                            debug=config.get('debug', True), server=config.get('server_middleware', 'tornado'))

The problem is that with wsgi I have to do this:

app = Bottle()

And Bottle constructor doesn't have any debug parameter. So what can I do to get the stacktrace?

推荐答案

import bottle
bottle.debug(True)

If you look at the source you can see that this function is called by the run function when providing debug.