Heroku app runs locally but gets H12 timeout error (uses a package)

六月ゝ 毕业季﹏ 提交于 2019-12-05 20:11:54

The issue is that run.py unguardedly calls app.run - this actually calls werkzeug.serving.run_simple which starts a sub-process to handle incoming requests ... which you don't want to do when running under gunicorn (since gunicorn will handle the process management for you).

Simply add an if __name__ == "__main__" guard before your app.run call and everything should work:

# run.py
if __name__ == "__main__":
    app.run()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!