python - 我的 Flask 应用程序在我的本地服务器上运行,但它没有在 Heroku 上运行。这怎么可能?
问题描述
这些是我的构建日志。我的应用程序显示错误。
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/
解决方案
您忘记将gunicorn
库添加到您的requirements.txt
. 如果没有 gunicorn,Web 应用程序将无法启动,因为它是 HTTP 服务器。要解决此问题,只需添加gunicorn==20.0.4
到您的 requirements.txt 即可。
推荐阅读
- spring-boot - 在 Spring Boot JMS 中更改 ActiveMQ 代理 JMX 端口 1099
- azure-devops - 如何自定义 Azure Board 中的标记颜色?
- ios - 以远程服务器为目标时,Cordova iOS 崩溃
- ios - OpenGL ES 在 iOS 12 和 SKShader 中已弃用
- java - Android:Firebase Cloud Messaging 未发送通知以构建 .apk
- angular - 高图表中大负值和小正值的 Y 轴
- javascript - Rails:javascript addEventListener 找不到动态形式的元素
- c# - 洗牌竞争对手名单,每个月都有不同的竞争对手
- java - 如何在 Java 中生成有效的 EAN13 条形码?
- blueprism - Blue Prism 应用程序建模器无法识别 Firefox 上的身份验证弹出窗口