在Python Flask中关闭stdout

时间:2018-01-29 06:56:55

标签: python flask

我的烧瓶代码输出到控制台的一些数据如下。它包括一些重要的客户信息。我想关闭来自Python / Flask的所有标准输出。有办法吗?

127.0.0.1 - - [29/Jan/2018 12:53:30] "GET /index?search_term=term HTTP/1.1" 200 -
127.0.0.1 - - [29/Jan/2018 12:53:32] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [29/Jan/2018 12:53:32] "GET /favicon.ico HTTP/1.1" 404  

@ sam-chats当我尝试使用> / dev / null没有任何改变

python3 main.py 
* Running on http://127.0.0.1:9876/ (Press CTRL+C to quit)
127.0.0.1 - - [29/Jan/2018 13:11:52] "GET /index HTTP/1.1" 200 -
127.0.0.1 - - [29/Jan/2018 13:12:00] "GET /index?search_term=python HTTP/1.1" 200 -

python3 main.py  > /dev/null
* Running on http://127.0.0.1:9876/ (Press CTRL+C to quit)
127.0.0.1 - - [29/Jan/2018 13:12:23] "GET /index?search_term=python HTTP/1.1" 200 -
127.0.0.1 - - [29/Jan/2018 13:12:28] "GET /index?search_term=sssss HTTP/1.1" 200 -

1 个答案:

答案 0 :(得分:0)

当您启动服务器程序时,请说main.py,执行python main.py > /dev/null