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

Issue

My first attempt was to just push to heroku without setting a default language manually:

(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'

So after setting it manually I am getting an error on how my app is incompatible with the 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'

I am unsure if this is because my python version is out of date (using python 3.9.5) or if there is an error elsewhere. Thank you for your help!!

Solution

Make sure you have requirements.txt in the root folder of your repository.

Answered By – Tadej Krevh

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published