我的Python打印件在哪里通过uWSGI在nginx下部署了Flask?

问题描述 投票:5回答:1

跟随this tutorial,我刚刚用nginx设置了uWSGI,以服务我在Flask中建立的网站,现在一切正常。

我有时想调试一些我通常在代码中使用基本print语句的东西。不幸的是,我不知道这些印刷品的结果在哪里?

我已经添加了以下日志文​​件,但是我看不到其中的打印文件:

/var/log/uwsgi/emperor.log
/var/log/uwsgi/myapp_uwsgi.log
/var/log/nginx/access.log
/var/log/nginx/error.log

有人知道我在哪里可以看到打印结果吗?

python linux nginx flask uwsgi
1个回答
3
投票

正常打印在stdout上进行,而Nginx仅记录stderr。

您应该改用flask的app.logger模块。看看the flask documentation on error handling

© www.soinside.com 2019 - 2024. All rights reserved.