Heroku无法识别Requirements.txt文件

时间:2020-04-26 20:49:13

标签: python heroku

我的目录结构是

  • Procfile
  • script.py
  • index.js
  • package.json
  • requirements.txt

并且我正在尝试将script.py作为计划的cronjob运行。我的requirements.txt文件的内容是:

requests==2.23.0
pymongo==3.10.1

Procfile的内容:

web: node index.js
clock: python script.py

但是我的日志不断说:

2020-04-26T20:42:22.000000+00:00 app[api]: Build started by user ****@gmail.com
2020-04-26T20:42:34.114621+00:00 heroku[clock.1]: State changed from crashed to starting
2020-04-26T20:42:34.149809+00:00 heroku[web.1]: Restarting
2020-04-26T20:42:34.153850+00:00 heroku[web.1]: State changed from up to starting
2020-04-26T20:42:33.681917+00:00 app[api]: Deploy #### by user ****@gmail.com
2020-04-26T20:42:33.681917+00:00 app[api]: Release v11 created by user ****@gmail.com
2020-04-26T20:42:33.000000+00:00 app[api]: Build succeeded
2020-04-26T20:42:36.711949+00:00 heroku[clock.1]: State changed from starting to up
2020-04-26T20:42:37.665706+00:00 app[web.1]: Server Running
2020-04-26T20:42:38.096571+00:00 heroku[web.1]: State changed from starting to up
2020-04-26T20:42:38.187393+00:00 heroku[clock.1]: State changed from up to crashed
2020-04-26T20:42:38.134156+00:00 app[clock.1]: Traceback (most recent call last):
2020-04-26T20:42:38.134180+00:00 app[clock.1]: File "script.py", line 1, in <module>
2020-04-26T20:42:38.134187+00:00 app[clock.1]: import requests
2020-04-26T20:42:38.134187+00:00 app[clock.1]: ImportError: No module named requests

根据文档,我的理解是,推送requirements.txt应该会使Heroku自动安装我的依赖项。这没有发生。我想念什么?

1 个答案:

答案 0 :(得分:0)

必须更新buildpack以使用除Node之外的Python。