可以将最后一行的app.run()修改为以下代码:

if name == 'main': app.run(host='0.0.0.0', port=5000)

这样可以避免在生产环境中使用开发服务器。同时,将host设置为0.0.0.0可以使得服务器监听所有可用的公共IP地址。

根据Python运行中提示 Serving Flask app 123 Debug mode off31m1mWARNING This is a development server Do not use it in a production deployment Use a production WSGI server instead0m Running on http1270015

原文地址: http://www.cveoy.top/t/topic/fmnh 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录