由于手动将其设置为 python 后构建包不兼容,我正在努力在 Heroku 上部署我的 Django 项目(Django 3.1)

I am struggling to deploy my Django project (Django 3.1) on Heroku due to an incompatible build-pack after manually setting it to python

我的第一次尝试是在不手动设置默认语言的情况下直接推送到 heroku:

(myenv) ➜  quotatev3 git:(main) heroku create quotatev3                           
 ›   Warning: heroku update available from 7.56.1 to 7.59.0.
Creating ⬢ quotatev3... done
https://quotatev3.herokuapp.com/ | https://git.heroku.com/quotatev3.git
(myenv) ➜  quotatev3 git:(main) git push heroku main   
Enumerating objects: 370, done.
Counting objects: 100% (370/370), done.
Delta compression using up to 8 threads
Compressing objects: 100% (321/321), done.
Writing objects: 100% (370/370), 74.35 KiB | 5.31 MiB/s, done.
Total 370 (delta 195), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to quotatev3.
remote: 
To https://git.heroku.com/quotatev3.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/quotatev3.git'

因此,在手动设置后,我收到一条错误消息,提示我的应用与 build-pack 不兼容。

 (myenv) ➜  quotatev3 git:(main) heroku create quotatev3 --buildpack heroku/python
     ›   Warning: heroku update available from 7.56.1 to 7.59.0.
    Creating ⬢ quotatev3... done
    Setting buildpack to heroku/python... done
    https://quotatev3.herokuapp.com/ | https://git.heroku.com/quotatev3.git
    (myenv) ➜  quotatev3 git:(main) gaa
    (myenv) ➜  quotatev3 git:(main) gcmsg 'config set'  
    On branch main
    nothing to commit, working tree clean
    (myenv) ➜  quotatev3 git:(main) git push heroku main
    Enumerating objects: 370, done.
    Counting objects: 100% (370/370), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (321/321), done.
    Writing objects: 100% (370/370), 74.35 KiB | 5.72 MiB/s, done.
    Total 370 (delta 195), reused 0 (delta 0), pack-reused 0
    remote: Compressing source files... done.
    remote: Building source:
    remote: 
    remote: -----> Building on the Heroku-20 stack
    remote: -----> Using buildpack: heroku/python
    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 quotatev3.
    remote: 
    To https://git.heroku.com/quotatev3.git
     ! [remote rejected] main -> main (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/quotatev3.git'

我不确定这是因为我的 python 版本已经过时(使用 python 3.9.5)还是其他地方有错误。谢谢你的帮助!!

确保您的存储库的根文件夹中有 requirements.txt。