首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Heroku中使用Quart

在Heroku中使用Quart
EN

Stack Overflow用户
提问于 2021-04-20 10:34:25
回答 1查看 63关注 0票数 1

现在我正在尝试在Heroku上托管一个Quart web应用。下面是我的测试代码:

代码语言:javascript
复制
#quartTest.py

from quart import Quart, request, Response

app = Quart(__name__)

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

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

我的配置文件当前是: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

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

代码语言:javascript
复制
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)

如果有人能帮我,我将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-04-20 11:36:43

将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))

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67171706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档