为什么项目不能部署在heroku上

时间:2021-02-23 20:03:46

标签: python django ubuntu heroku

我正在 heroku 上使用 Django 部署我的第一个项目。我陷入了一个错误:

remote: -----> Installing python-3.8.5
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting appdirs==1.4.3
remote:          Downloading appdirs-1.4.3-py2.py3-none-any.whl (12 kB)
remote:        ERROR: Could not find a version that satisfies the requirement apt-xapian-index==0.49 (from -r /tmp/build_4d208449/requirements.txt (line 2)) (from versions: none)
remote:        ERROR: No matching distribution found for apt-xapian-index==0.49 (from -r /tmp/build_4d208449/requirements.txt (line 2))
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: b6448ab5f99718f2452407bed32ed667b2e2c8d6
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version b6448ab5f99718f2452407bed32ed667b2e2c8d6
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 todo-app04.
remote: 

确切的错误是:

remote:        ERROR: Could not find a version that satisfies the requirement apt-xapian-index==0.49 (from -r /tmp/build_4d208449/requirements.txt (line 2)) (from versions: none)
remote:        ERROR: No matching distribution found for apt-xapian-index==0.49 (from -r /tmp/build_4d208449/requirements.txt (line 2))
remote:  !     Push rejected, failed to compile Python app.

我不知道为什么会这样。

这是requirements.txt:

appdirs==1.4.3
apt-xapian-index==0.49
arrow==0.17.0
asgiref==3.3.1
attrs==20.3.0
base58==2.0.1
bcrypt==3.1.7
beautifulsoup4==4.9.3
bitcoinrpc==0.3.1
blinker==1.4
bs4==0.0.1
certifi==2019.11.28
chardet==3.0.4
click==6.6
colorama==0.4.3
command-not-found==0.3
cryptography==2.8
cupshelpers==1.0
dbus-python==1.2.16
defer==1.0.6
distlib==0.3.0
distro==1.4.0
distro-info===0.23ubuntu1
Django==3.1.4
django-bitcoin==0.2
django-json-rpc==0.7.2
docker-py==1.8.0
ecdsa==0.16.1
entrypoints==0.3
filelock==3.0.12
flake8==3.8.4
funcsigs==1.0.2
future==0.18.2
galternatives==1.0.6
gpg===1.13.1-unknown
gunicorn==20.0.4
h11==0.12.0
httpcore==0.12.2
httplib2==0.14.0
httpx==0.16.1
idna==2.8
importlib-metadata==1.5.0
iniconfig==1.1.1
Jinja2==2.10.1
json-rpc==1.13.0
jsonrpcclient==2.0.1
jsonrpcserver==3.1.1
jsonschema==3.2.0
keyring==18.0.1
language-selector==0.1
launchpadlib==1.10.13
lazr.restfulclient==0.14.2
lazr.uri==1.0.3
lubuntu-update-notifier==0.1
MarkupSafe==1.1.0
mccabe==0.6.1
mnemonic==0.13
more-itertools==4.2.0
netifaces==0.10.4
oauthlib==3.1.0
olefile==0.46
orjson==3.4.6
packaging==20.8
path==15.0.1
path.py==12.5.0
pbkdf2==1.3
pexpect==4.6.0
Pillow==7.0.0
pluggy==0.13.1
protobuf==3.0.0a3
proton-client==0.2.0
protonvpn-cli==3.2.1
protonvpn-nm-lib==0.3.0
py==1.10.0
pyaes==1.6.1
pycairo==1.16.2
pycodestyle==2.6.0
pycryptodome==3.9.9
pycups==1.9.73
pyflakes==2.2.0
PyGObject==3.36.0
PyJWT==1.7.1
pymacaroons==0.13.0
PyNaCl==1.3.0
pyOpenSSL==19.0.0
pyparsing==2.4.7
PyQt5==5.14.1
pyrsistent==0.17.3
PySocks==1.6.8
pytest==6.2.1
python-apt==2.0.0+ubuntu0.20.4.4
python-dateutil==2.8.1
python-debian===0.1.36ubuntu1
python-gnupg==0.4.5
pythondialog==3.4.0
pytz==2020.5
pywallet==0.1.0
pyxdg==0.26
PyYAML==5.3.1
qrcode==6.1
reportlab==3.5.34
requests==2.11.1
requests-unixsocket==0.2.0
rfc3986==1.4.0
SecretStorage==2.3.1
sha256==0.1
simplejson==3.16.0
sip==4.19.21
six==1.14.0
sniffio==1.2.0
soupsieve==2.2
sqlparse==0.4.1
systemd-python==234
tabulate==0.8.7
toml==0.10.2
torbrowser-launcher==0.3.2
two1==3.10.9
typing-extensions==3.7.4.3
ubuntu-advantage-tools==20.3
ubuntu-drivers-common==0.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.25.8
usb-creator==0.3.7
virtualenv==20.0.17
wadllib==1.3.3
websocket-client==0.57.0
whitenoise==5.2.0
xkit==0.0.0
zipp==1.0.0

我已经使用:sudo apt-get install apt-xapian-index 在我的电脑中安装了:apt-xapian-index,但仍然显示相同的错误。 任何答案都会有帮助

2 个答案:

答案 0 :(得分:0)

apt-xapian-index 不是通过 pip 安装的 Python Package Index (PyPI) 上的 Python 包,而是 Debian/Ubuntu package(通过 apt-get 安装)。您不能将该包放入您的 requirements.txt 文件中,因为该文件仅用于 Python 包。

您也许可以使用来自 pip 的 xapian-bindings 之类的包,但 Heroku 可能不允许您在没有更多配置的情况下开箱即用地编译绑定。

答案 1 :(得分:0)

apt-xapian-index==0.49 中删除 requirements.txt,否则您的 Python 依赖项安装尝试将失败。 (它会尝试在 http://pypi.org/ 上查找不存在的包。)

添加第二个构建包:https://github.com/heroku/heroku-buildpack-apt

使用内容 Aptfile 创建一个 apt-xapian-index

相关问题