Heroku is a platform that enables you to deploy your web application in a quick and painless manner; unless you're stumbling upon a 'Push rejected' error with next to no hint how to resolve it.
I stumpled upon this when trying to deploy a flask app but I'm pretty sure this
will also happen with django apps. Here's what happened: When deploying to
heroku you first have to initialize a git repository. For Python apps in
particular, you also have to provide a
requirements.txt that consists of the
dependencies of your application. This is a pretty standard. What was new to me
that you also have to provide a
runtime.txt that tells heroku which Python
version your app was written in. As naive as I was, I merely checked for the
Python version in my Anaconda environment and put python-3.7.4 in the file,
committed and pushed to heroku via
git push heroku master. Here's what I got
1remote: Compressing source files... done.
2remote: Building source:
4remote: -----> Python app detected
5remote: ! Python has released a security update! Please consider upgrading to python-3.7.3
6remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
7remote: -----> Installing python-3.7.4
8remote: -----> Installing pip
9remote: -----> Installing requirements with pip
10remote: ! Push rejected, failed to compile Python app.
12remote: ! Push failed
That was not helpful at all. Especially the hint at upgrading to python-3.7.3 was confusing me because my proposed runtime was even more recent. The build log did not reveal anything new either.
After being confused for about half an hour, suspecting that heroku could not
cope with my requirements at first, at finally found out that heroku does not support python-3.7.4 as a runtime! In fact, heroku only supports three specific
python runtimes at the moment. Thus, the solution is to simply use
python-3.7.3 as a runtime.