1

现在我正在尝试在 Heroku 上托管一个 Quart 网络应用程序。这是我的测试代码:

#quartTest.py

from quart import Quart, request, Response

app = Quart(__name__)

@app.route('/')
def index():
    return 'hello world'

if __name__ == '__main__':
    app.run()

我的 Procfile 目前是:web: hypercorn -b 0.0.0.0:5000 quartTest:app

这是我的错误:Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

这是一些日志,它将永远重复:

2021-04-20T03:19:38.541174+00:00 heroku[web.1]: State changed from crashed to starting
2021-04-20T03:19:42.507344+00:00 heroku[web.1]: Starting process with command `hypercorn -b 0.0.0.0:5000 quartTest:app`
2021-04-20T03:19:46.446529+00:00 app[web.1]: [2021-04-20 03:19:46 +0000] [4] [INFO] Running on http://0.0.0.0:5000 (CTRL + C to quit)
2021-04-20T03:19:47.000000+00:00 app[api]: Build succeeded
2021-04-20T03:20:42.755100+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-04-20T03:20:42.932268+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-04-20T03:20:43.043982+00:00 heroku[web.1]: Process exited with status 137
2021-04-20T03:20:43.111245+00:00 heroku[web.1]: State changed from starting to crashed
2021-04-20T03:20:43.115104+00:00 heroku[web.1]: State changed from crashed to starting
2021-04-20T03:20:47.727102+00:00 heroku[web.1]: Starting process with command `hypercorn -b 0.0.0.0:5000 quartTest:app`
2021-04-20T03:20:52.904681+00:00 app[web.1]: [2021-04-20 03:20:52 +0000] [4] [INFO] Running on http://0.0.0.0:5000 (CTRL + C to quit)

如果有人可以帮助我,我将不胜感激。

4

1 回答 1

0

将 Procfile 设置为web hypercorn -b 0.0.0.0:$PORT quartTest:app

如果你正在运行一个不和谐的机器人,你将不得不改变

bot.loop.create_task(app.run_task())

bot.loop.create_task(api.app.run_task(host='0.0.0.0', port=PORT))

于 2021-04-20T03:36:42.637 回答