【问题标题】:Heroku Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launchHeroku 错误 R10(启动超时)-> Web 进程在启动后 60 秒内无法绑定到 $PORT
【发布时间】:2016-11-06 02:48:54
【问题描述】:

尽管在互联网上尝试了所有方法,但我仍然收到此错误。 我正在尝试在 Heroku 上运行我的烧瓶应用程序。

下面是我的 ProcFile

web gunicorn -b 127.0.0.1:8000 geeni:app 

下面是我的 geeni.py 文件。

class ChargeUser(Resource):
    def post(self):
        jsonData = request.get_json(force=True)
        stripeid = jsonData['stripeid_customer']
        currency = jsonData['currency']
        amount = jsonData['amount']
        apiKey = jsonData['api_key']
        try:
            stripe.Charge.create(amount = amount, source=stripeid, currency=currency)
            return jsonify({'Msg':'Charged!'})
        except:
            raise

api.add_resource(ChargeUser,'/')
if __name__ == '__main__':
    app.run()

我已经设置了我的 heroku 推送/登录所有内容,并且完全按照教程进行操作。没有运气..

【问题讨论】:

    标签: python heroku flask


    【解决方案1】:

    您的 Procfile 应该是 web: gunicorn -b 0.0.0.0:$PORT greeni:app。正如目前所写,Heroku 永远不会看到您的应用程序已准备好接收入站连接:

    • 127.0.0.1 接口不会接收任何外部网络流量。相反,0.0.0.0 字符串确实绑定到所有外部接口。
    • Heroku 通过 $PORT 变量传递所需的端口,通常为 5000。

    请记住 - Heroku 管理“路由网格”,它接收入站 HTTP 流量,然后将其转发到您的应用程序。它分配地址和端口,不能在您的 Procfile 中硬编码。

    【讨论】:

      猜你喜欢
      • 2016-03-08
      • 2015-09-14
      • 2021-07-26
      • 2017-06-22
      • 1970-01-01
      • 2021-04-05
      • 2021-08-19
      • 2021-09-03
      • 2021-05-17
      相关资源
      最近更新 更多