Push rejected failed to compile python app

so i get this error when i try to deploy my master branch, i have set my requirements.txt, runtime.txt and Procfile but i still get this error

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in runtime.txt
 !     Requested runtime (python - 3.9.7) is not available for this stack (heroku-20).
 !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
 !     Push rejected, failed to compile Python app.
 !     Push failed

my requirements.txt file

asgiref==3.4.1
dj-database-url==0.5.0
Django==3.2.7
django-heroku==0.3.1
gunicorn==20.1.0
Pillow==8.4.0
psycopg2==2.9.2
python-decouple==3.5
pytz==2021.3
sqlparse==0.4.2
whitenoise==5.3.0

please help

Your python version is not supported on heroku stack 20 as stated in the fifth line to check supported runtime see Heroku documentation

Heroku stack supports python-3.9.9 so specify that in your runtime.txt:

python-3.9.9

Have a look at the stack at https://devcenter.heroku.com/articles/heroku-20-stack

Back to Top