简体   繁体   English

Flask的@before_request执行多次

[英]Flask's @before_request executes more than once

I added an app.logger.error('test') inside my @app.before_request and noticed that there are up to 8 lines of test in my log per request, even if it's just abort(500) . 我在@app.before_request添加了一个app.logger.error('test')并注意到每个请求的日志中最多有8行test ,即使只是abort(500) I just can't seem to find out why, what could cause this? 我似乎无法找出原因,这可能是什么原因造成的?

If you run with app.debug = True and serve media files (images, css, js etc.) from Flask, they also count as full requests. 如果您使用app.debug = True运行并从Flask提供媒体文件(图像,css,js等),它们也将视为完整请求。 If that is not the case, then please provide some more information about your setup. 如果不是这种情况,请提供有关您的设置的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM