【问题标题】:My Flask app is running on my local server, but it isn't running on Heroku. How is this possible?我的 Flask 应用程序在我的本地服务器上运行,但它没有在 Heroku 上运行。这怎么可能?
【发布时间】:2020-11-29 12:27:50
【问题描述】:

这些是我的构建日志。我的应用显示错误。

2020-08-09T20:25:31.000000+00:00 app[api]: Build succeeded

2020-08-09T20:25:33.898890+00:00 app[web.1]: bash: gunicorn: command not found

2020-08-09T20:25:33.955046+00:00 heroku[web.1]: Process exited with status 127

2020-08-09T20:25:33.996024+00:00 heroku[web.1]: State changed from starting to crashed

2020-08-09T20:25:42.118494+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=imagen-iitb.herokuapp.com request_id=b4762bc9-5410-443d-a630-d6ea43891527 fwd="103.240.97.60" dyno= connect= service= status=503 bytes= protocol=https

2020-08-09T20:25:48.479794+00:00 heroku[web.1]: State changed from crashed to starting

2020-08-09T20:25:53.064583+00:00 heroku[web.1]: Starting process with command `gunicorn run:app`

2020-08-09T20:25:55.106853+00:00 app[web.1]: bash: gunicorn: command not found

2020-08-09T20:25:55.149435+00:00 heroku[web.1]: Process exited with status 127

2020-08-09T20:25:55.179854+00:00 heroku[web.1]: State changed from starting to crashed

这是我的requirements.txt

bcrypt==3.1.7
blinker==1.4
cffi==1.14.1
click==7.1.2
DateTime==4.3
email-validator==1.1.1
Flask==1.1.2
Flask-Bcrypt==0.7.1
Flask-Login==0.5.0
Flask-Mail==0.9.1
Flask-SQLAlchemy==2.4.4
Flask-WTF==0.14.3
googleapis-common-protos==1.52.0
httplib2==0.18.1
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
jws==0.1.3
MarkupSafe==1.1.1
oauth2client==3.0.0
ordereddict==1.1
Pillow==6.2.2
protobuf==4.0.0rc2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pycryptodome==3.4.3
Pyrebase==3.0.27
python-firebase==1.2
python-jwt==2.0.1
pytz==2020.1
requests==2.11.1
requests-toolbelt==0.7.0
rsa==4.5
six==1.15.0
SQLAlchemy==1.3.18
Werkzeug==1.0.1
WTForms==2.3.3
zope.interface==5.1.0

如果您需要,我可以提供我的代码。谢谢。

编辑:我的数据没有更新到我的 SQL-Alchemy 数据库文件 (site.db)

我的应用在线:https://imagen-iitb.herokuapp.com/

【问题讨论】:

    标签: python flask heroku web-applications


    【解决方案1】:

    您忘记将gunicorn 库添加到您的requirements.txt。如果没有 gunicorn,Web 应用程序将无法启动,因为它是 HTTP 服务器。要解决此问题,只需将 gunicorn==20.0.4 添加到您的 requirements.txt 即可。

    【讨论】:

    • 非常感谢您的及时回复。我没有检查我的 requirements.txt 文件属性。感谢您指出我的愚蠢错误:)
    • 别担心!很高兴我能帮上忙
    猜你喜欢
    • 2019-05-24
    • 1970-01-01
    • 2013-08-08
    • 1970-01-01
    • 2018-02-05
    • 2016-06-19
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多