Heroku push can't find Django 3.2.8

When pushing my git repository to heroku it fails and gives this error:

remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the same version as the last build: python-3.9.7
remote:        To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Requirements file has been changed, clearing cached dependencies
remote: -----> Installing python-3.9.7
remote: -----> Installing pip 20.2.4, setuptools 57.5.0 and wheel 0.37.0
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting Gunicorn==20.1.0
remote:          Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
remote:        Collecting Jinja2==2.11.2
remote:          Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
remote:        Collecting Django-Heroku==0.3.1
remote:          Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
remote:        ERROR: Could not find a version that satisfies the requirement Django-3.2.8 (from -r /tmp/build_43fa9180/requirements.txt (line 4)) (from versions: none)
remote:        ERROR: No matching distribution found for Django-3.2.8 (from -r /tmp/build_43fa9180/requirements.txt (line 4))
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 262a4549043aa448dc2000c886cad672f979d8f0
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 262a4549043aa448dc2000c886cad672f979d8f0
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 shrouded-bastion-04661.
remote:
To https://git.heroku.com/shrouded-bastion-04661.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shrouded-bastion-04661.git'

It is using python 3.9.7 which is compatible with django 3.2.8. The weird part is that everything built fine until I followed this tutorial on using Azure to host static files https://medium.com/@DawlysD/django-using-azure-blob-storage-to-handle-static-media-assets-from-scratch-90cbbc7d56be

Since then I've had to install PostgreSQL and Visual Studio just to get a pg_config file to work.

Edit: Here is the requirements.txt:

Gunicorn==20.1.0
Jinja2==2.11.2
Django-Heroku==0.3.1
Django-3.2.8
asgiref-3.4.1
azure-core-1.19.0
azure-storage-blob-12.9.0
certifi-2021.10.8
cffi-1.15.0
charset-normalizer-2.0.7
cryptography-35.0.0
django-storages-1.12.2
idna-3.3
isodate-0.6.0
msrest-0.6.21
oauthlib-3.1.1
pycparser-2.20
pytz-2021.3
requests-2.26.0
requests-oauthlib-1.3.0
six-1.16.0
sqlparse-0.4.2
urllib3-1.26.7

1 answer

  • answered 2021-10-25 00:12 Chris

    - is invalid in version specifiers.

    All of your dependencies in the format package-version need to be changed to package==version.

    For example, change

    Django-3.2.8
    

    to

    Django==3.2.8
    

    and

    azure-storage-blob-12.9.0
    

    to

    azure-storage-blob==12.9.0
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum