简体   繁体   English

将Flask应用程序部署到Heroku-Web.1:崩溃

[英]Deploying flask app to Heroku - web.1: crashed

I am trying to deploy a Flask app to Heroku, but get this error: 我正在尝试将Flask应用程序部署到Heroku,但出现此错误:

(hn_api)karan:hn$ heroku ps:scale web=1
Scaling web dynos... done, now running 1
(hn_api)karan:hn$ heroku ps
=== web (1X): `gunicorn app:app`
web.1: crashed 2013/10/28 11:13:09 (~ 4h ago)

This is (all) my code: 这是(全部)我的代码:

#!/bin/env python

from flask import Flask, jsonify
from hn import HN

app = Flask(__name__)

@app.route('/get/top', methods = ['GET'])
def get_top():
    hn = HN()
    return jsonify({'stories': hn.get_stories()})

@app.route('/get/<story_type>', methods = ['GET'])
def get_stories(story_type):
    hn = HN()
    return jsonify({'stories': hn.get_stories(story_type=story_type)})

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

Any my Procfile 我的任何Procfile

web: gunicorn app:app

And here is a part of my log. 这是我的日志的一部分。

2013-10-28T12:18:46.452117+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2013-10-28T12:18:46.997214+00:00 app[web.1]: bash: gunicorn: command not found
2013-10-28T12:18:48.223621+00:00 heroku[web.1]: Process exited with status 127
2013-10-28T12:18:48.247723+00:00 heroku[web.1]: State changed from starting to crashed
2013-10-28T16:18:49.078986+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=hnify.herokuapp.com fwd="173.250.172.145" dyno= connect= service= status=503 bytes=
2013-10-28T16:19:22.487749+00:00 heroku[api]: Scale to web=1 by xxxxx@gmail.com
2013-10-28T16:16:52.141316+00:00 heroku[api]: Scale to web=1 by xxxxx@gmail.com
2013-10-28T16:23:29.318342+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=hnify.herokuapp.com fwd="173.250.172.145" dyno= connect= service= status=503 bytes=
2013-10-28T16:23:24.607044+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=hnify.herokuapp.com fwd="173.250.172.145" dyno= connect= service= status=503 bytes=
2013-10-28T16:23:18.342334+00:00 heroku[api]: Scale to web=1 by xxxxx@gmail.com
2013-10-28T18:13:04.249763+00:00 heroku[web.1]: State changed from crashed to starting
2013-10-28T18:13:07.083816+00:00 heroku[web.1]: Starting process with command `gunicorn app:app`
2013-10-28T18:13:07.654840+00:00 app[web.1]: bash: gunicorn: command not found
2013-10-28T18:13:08.854338+00:00 heroku[web.1]: State changed from starting to crashed
2013-10-28T18:13:08.839414+00:00 heroku[web.1]: Process exited with status 127
2013-10-28T22:32:35.548598+00:00 heroku[api]: Scale to web=1 by xxxxx@gmail.com

I am not sure how helpful the log is here because I could not find anything here. 我不确定这里的日志有多有用,因为我在这里找不到任何内容。

Can anyone help me out? 谁能帮我吗?

2013-10-28T18:13:07.654840+00:00 app[web.1]: bash: gunicorn: command not found? 2013-10-28T18:13:07.654840 + 00:00 app [web.1]:bash:gunicorn:命令未找到?

You should add gunicorn to setup.py/requirements.txt/whatever you use to manage dependencies 您应该将gunicorn添加到setup.py/requirements.txt/用于管理依赖项的任何内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM