Heroku 推送找不到 Django 3.2.8
Heroku push can't find Django 3.2.8
将我的 git 存储库推送到 heroku 时失败并出现此错误:
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'
它正在使用与 django 3.2.8 兼容的 python 3.9.7。奇怪的是,一切都很好,直到我按照本教程使用 Azure 托管静态文件 https://medium.com/@DawlysD/django-using-azure-blob-storage-to-handle-static-media-assets-from-scratch-90cbbc7d56be
从那时起我不得不安装 PostgreSQL 和 Visual Studio 只是为了让 pg_config 文件工作。
编辑:
这是 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
-
在 version specifiers 中无效。
格式 package-version
中的所有依赖项都需要更改为 package==version
。
例如改
Django-3.2.8
到
Django==3.2.8
和
azure-storage-blob-12.9.0
到
azure-storage-blob==12.9.0
将我的 git 存储库推送到 heroku 时失败并出现此错误:
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'
它正在使用与 django 3.2.8 兼容的 python 3.9.7。奇怪的是,一切都很好,直到我按照本教程使用 Azure 托管静态文件 https://medium.com/@DawlysD/django-using-azure-blob-storage-to-handle-static-media-assets-from-scratch-90cbbc7d56be
从那时起我不得不安装 PostgreSQL 和 Visual Studio 只是为了让 pg_config 文件工作。
编辑: 这是 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
-
在 version specifiers 中无效。
格式 package-version
中的所有依赖项都需要更改为 package==version
。
例如改
Django-3.2.8
到
Django==3.2.8
和
azure-storage-blob-12.9.0
到
azure-storage-blob==12.9.0