Flask 时快时慢的问题

app.run(host="", port=8080)

当 app.run 设置成这样的时候,有时候页面加载会时快时慢。 原来默认 Flask 是单线程的,需要更改参数。

app.run(host="", port=8080, threaded=True)


werkzeug.serving.run_simple(hostname, port, application, use_reloader=False, use_debugger=False, use_evalex=True, extra_files=None, reloader_interval=1, reloader_type='auto', threaded=False, processes=1, request_handler=None, static_files=None, passthrough_errors=False, ssl_context=None)
threaded – should the process handle each request in a separate thread?
processes – if greater than 1 then handle each request in a new process up to this maximum number of concurrent processes.