运行烧瓶应用程序时,例如
...
if __name__ is "__main__":
app.run(port=self.port)
...
有些消息正在运行。
* Serving Flask app "__main__" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
如何禁用所有这些消息?
答案 0 :(得分:1)
要禁止Flask显示关于在生产环境中使用开发服务器的警告信息,请在运行flask之前添加以下2行:
from flask import Flask
import sys
cli = sys.modules['flask.cli']
cli.show_server_banner = lambda *x: None
app = Flask(__name__)
app.run(host='0.0.0.0', port='80')
https://gist.github.com/jerblack/735b9953ba1ab6234abb43174210d356
答案 1 :(得分:0)
尝试一下。 导出WERKZEUG_RUN_MAIN = true