Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Bottle 框架。我已经设置了@error装饰器,所以我可以显示我自定义的错误页面,如果发生任何 500 错误,我也可以发送电子邮件,但我需要在电子邮件中发送完整的回溯。有谁知道如何让框架包含在电子邮件中?
@error
在 @error 装饰器之后编写的 error500 函数中为我自定义的错误页面提供服务,写了error.exceptionand error.traceback,这两个给出了错误消息的异常和完整的回溯。
error.exception
error.traceback
调试模式启用完整的回溯:
from bottle import debug debug(True)
从那里,您需要通过管道stderr传输到一个文件,然后发送它。
stderr