1.Flask提供的Web服务器不适合在生产环境中使用
2.run方法启动flask集成的服务器:
例:
if __name__ == '__main__':
app.run(debug=True)
3.源码:
def run(self, host='localhost', port=5000, **options):
"""Runs the application on a local development server. If the
:attr:`debug` flag is set the server will automatically reload
for code changes and show a debugger in case an exception happened.
:param host: the hostname to listen on. set

本文探讨了Flask内置Web服务器的局限性,详细解析了`run`方法启动集成服务器的过程,强调了在生产环境中不应使用此服务器。通过示例展示了如何调用`run`方法,并揭示了其内部依赖于Werkzeug库的`run_simple`方法,以及`debug`参数如何影响`use_reloader`和`use_debugger`选项。
最低0.47元/天 解锁文章
463

被折叠的 条评论
为什么被折叠?



