我正在尝试将django应用程序部署到heroku。在尝试部署期间,我遇到了一个错误:应用程序与buildpack不兼容我第一次这么做,我不知道我做错了什么。可能是我的主分支位于venw目录上,而应用程序的目录位于主分支上。我试过使用call:git在主分支上推heroku main,但它不起作用。我的主要分支包含文件要求。txt、procfile和运行时。txt。有必要将应用程序从主分支推送到heroku,或者也可以从主分支推送到heroku?你知道怎么解决我的问题吗?
我的git bash日志如下:
ggb@DESKTOP-PNHHOHJ MINGW64/c/projekty/tabele/tabenv(主)$ls Include/Lib/pyvenv。cfg要求。txt运行时。txt脚本/tabele/(tabenv)gg@DESKTOP-PNHHOHJ MINGW64/c/projekty/tabele/tabenv(master)$git push heroku master枚举对象:9191,完成。计数对象:100%(9191/9191),完成。使用最多4个线程压缩对象的增量压缩:100%(5820/5820),完成。写入对象:100%(9191/9191),17.71 MiB | 4.76 MiB/s,完成。总计9191(增量2299),重用9184(增量2296),包重用0远程:压缩源文件。。。完成。远程:建筑源:远程:远程:-----
gg@DESKTOP-PNHHOHJ MINGW64 /c/projekty/tabele/tabenv/tabele (main)
$ ls
db.sqlite3 manage.py* requiremenrs.txt staticfiles/
formula/ Procfile runtime.txt tabele/
(tabenv)
gg@DESKTOP-PNHHOHJ MINGW64 /c/projekty/tabele/tabenv/tabele (main)
$ git push heroku main
Enumerating objects: 155, done.
Counting objects: 100% (155/155), done.
Delta compression using up to 4 threads
Compressing objects: 100% (144/144), done.
Writing objects: 100% (155/155), 177.22 KiB | 2.27 MiB/s, done.
Total 155 (delta 62), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
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: !
remote: ! ## Warning - The same version of this code has already been built: eaefbfee8a53854c985b523ac2371f3881297e6d
remote: !
remote: ! We have detected that you have triggered a build from source code with version eaefbfee8a53854c985b523ac2371f3881297e6d
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to pure-earth-78865.
remote:
To https://git.heroku.com/pure-earth-78865.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pure-earth-78865.git'
(tabenv)
remote: -----> Building on the Heroku-20 stack
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
Python构建包的detect
脚本可在以下位置找到:https://github.com/heroku/heroku-buildpack-python/blob/main/bin/detect
if [ ! -f "$BUILD_DIR/requirements.txt" ] && [ ! -f "$BUILD_DIR/setup.py" ] && [ ! -f "$BUILD_DIR/Pipfile" ]; then
exit 1
fi
它检查在git repo的根目录中是否存在requirements.txt
,setup.py
或Pipfile
。它不存在于你的情况下,因此它是失败的。
此错误通常来自您的需求。文本文件或配置文件。仔细检查这些文件,确保git没有忽略它们