(venv) D:\workspace\python\test>python test_flask.py * Serving Flask app "test_flask" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 执行后台任务... 127.0.0.1 - - [24/Nov/2020 16:02:22] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [24/Nov/2020 16:02:22] "GET /favicon.ico HTTP/1.1" 404 - 执行后台任务... 执行后台任务...
if __name__ == "__main__": start_runner() app.run()
同样的,运行一下代码看一下结果:
1 2 3 4 5 6 7 8 9 10
(venv) D:\workspace\python\test>python test_flask.py 执行后台任务... * Serving Flask app "test_flask" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 执行后台任务... 执行后台任务...