【发布时间】:2020-08-18 14:26:36
【问题描述】:
我编写了一个相当简单的 Python/Django 应用程序,并希望将其部署到 Heroku。
由于项目从第一天开始就在 GIT 中进行跟踪,因此我的首选策略是使用 Heroku CLI 来部署它。我已经创建了所有必要的元文件(Procfile、requirements.txt、Pipfile 等)。我还在我的 settings.py 文件中添加了所有必要的库和设置(我们可以放心地假设一切设置正确,因为项目最终部署并正常工作)。
我已将 Heroku CLI 更新到最新版本。它似乎在我所有的“终端”客户端中都能正常工作:PowerShell、GitBash、Termius。
然而,当我尝试执行良好的“git push heroku master”时,该过程会启动,但是它会失败,因为它无法确定要使用的适当构建包。在 Heroku 设置中手动指示 buildpack 时,CLI 说 buildpack 不兼容:
PS C:\Users\mkokot\Dev\project-master> git push heroku master
Enumerating objects: 29, done.
Counting objects: 100% (29/29), done.
Delta compression using up to 8 threads
Compressing objects: 100% (25/25), done.
Writing objects: 100% (29/29), 917.94 KiB | 114.74 MiB/s, done.
Total 29 (delta 12), reused 6 (delta 2)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to myherokuapp.
remote:
To https://git.heroku.com/ciaplist.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/myherokuapp.git'
注意:我在上面的示例中更改了项目名称/url,我没有尝试将示例设置应用于此操作:)
回到“你怎么知道你配置了所有东西”这个问题:一旦我改变了从 GitHub 部署的策略,一切都像魅力一样工作,并且 buildpack 被正确识别和执行。但是,我觉得这种部署方式很麻烦。
问题:你知道为什么相同的代码可能会被 GitHub 接受但被 Heroku CLI 拒绝吗?在哪里查找要修改的错误/设置?我很想看到“git push heroku master”的工作!
【问题讨论】:
标签: git github heroku heroku-toolbelt heroku-cli