我编写了一个相当简单的Python/Django应用程序,并希望将其部署到Heroku。
由于该项目从第一天起就在GIT中被跟踪,我的进入策略是使用Heroku来部署它。我已经创建了所有必要的元文件(Procfile,requirements.txt,Pipfile等).我还将所有必要的库和设置添加到我的settings.py文件中(我们可以安全地假设所有的设置都是正确的,因为项目最终是正确部署和工作的)。
我已经更新了Heroku CLI的最新版本。在我所有的“终端”客户端: PowerShell、GitBash、Termius,它似乎都正常工作。
然而,当我试图执行好的'ol‘"git push heroku主“过程时,它会失败,因为它无法确定要使用的适当的buildpack。当在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'注意:我在上面的示例中更改了项目名称/urls,我没有尝试将示例设置应用于此操作:)
回到“您如何知道您正确配置了所有内容”的问题:一旦将我的策略从GitHub更改为部署,一切都像魅力一样工作,并且正确地识别和执行了构建包。但是,我发现这种部署方式很麻烦。
的问题:,您知道为什么相同的代码可能被GitHub接受而被Heroku拒绝吗?在哪里查找要修改的错误/设置?我很想看看"git推heroku大师“的作品!
发布于 2020-05-04 19:42:06
好吧,其实很简单。
当使用CLI部署到Heroku时,Heroku工具箱总是尝试将本地存储库的master分支推到heroku master存储库。我准备部署的代码在另一个分支中。
为了将master以外的分支推到Heroku,您需要使用:
git push heroku your_branch_name:master
更多细节:https://devcenter.heroku.com/articles/git#deploying-code
自己人!
https://stackoverflow.com/questions/61587527
复制相似问题