【问题标题】:During deploying Django blog on heroku showes me errors在 heroku 上部署 Django 博客期间显示错误
【发布时间】:2020-07-14 05:55:35
【问题描述】:

当我在 heroku 中部署应用程序时显示此错误

remote: ERROR: Could not find a version that satisfies the requirement apturl==0.5.2 (from -r /tmp/build_16067d5dbf345d8d906970e4d4f44d30/requirements.txt

我在互联网上搜索以找到该问题的解决方案,但无法成功找到。

所以我向你展示了我在 heroku 中部署应用程序的步骤 我在终端输入了

heroku login    
pip3 freeze
pip3 freeze > requirements.txt

然后在终端中安装 gunicorn 类型

pip3 install gunicorn

然后在根目录下创建一个文件,写入名称为我写的Procifle

web: gunicorn django_project.wsgi

然后是我的heroku博客名称

heroku git:remote -a naqviblog

我还向你展示了我的 requirements.txt 文件

apturl==0.5.2
asgiref==3.2.3
asn1crypto==0.24.0
blinker==1.4
boto3==1.9.96
botocore==1.12.96
Brlapi==0.6.7
certifi==2018.8.24
chardet==3.0.4
command-not-found==0.3
cryptography==2.3
cupshelpers==1.0
defer==1.0.6
distro==1.3.0
distro-info===0.21ubuntu2
dj-database-url==0.5.0
Django==3.0.4
django-crispy-forms==1.9.0
django-heroku==0.3.1
django-storages==1.7.1
docutils==0.14
entrypoints==0.3
f.lux-indicator-applet==1.1.11rc0
galternatives==1.0.3
gunicorn==20.0.4
httplib2==0.11.3
idna==2.6
jmespath==0.9.3
keyring==17.1.1
keyrings.alt==3.1.1
language-selector==0.1
launchpadlib==1.10.6
lazr.restfulclient==0.14.2
lazr.uri==1.0.3
lightdm-gtk-greeter-settings==1.2.2
louis==3.8.0
macaroonbakery==1.2.1
Mako==1.0.7
MarkupSafe==1.1.0
netifaces==0.10.4
oauth==1.0.1
oauthlib==2.1.0
olefile==0.46
pbr==5.4.4
pexpect==4.6.0
Pillow==5.4.1
protobuf==3.6.1
psycopg2==2.7.7
pycairo==1.16.2
pycrypto==2.6.1
pycups==1.9.73
PyGObject==3.32.0
PyJWT==1.7.0
pymacaroons==0.13.0
PyNaCl==1.3.0
pyOpenSSL==19.0.0
pyRFC3339==1.1
python-apt===1.8.5-ubuntu0.3
python-dateutil==2.7.3
python-debian==0.1.34
python-decouple==3.3
pytz==2018.9
pyxattr==0.6.1
pyxdg==0.25
PyYAML==3.13
reportlab==3.5.18
requests==2.21.0
requests-unixsocket==0.1.5
s3transfer==0.2.0
SecretStorage==2.3.1
simplejson==3.16.0
six==1.12.0
sqlparse==0.3.1
system-service==0.3
systemd-python==234
testresources==2.0.1
ubuntu-advantage-tools==19.2
ubuntu-drivers-common==0.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.24.1
usb-creator==0.3.3
virtualenv==15.1.0
wadllib==1.3.3
whitenoise==4.1.2
xkit==0.0.0
youtube-dl==2019.1.17
zope.interface==4.3.2

然后在终端输入

git add .
git commit -m "commit changes"

最后输入

git push heroku master

然后告诉我这个错误

Enumerating objects: 77, done.
Counting objects: 100% (77/77), done.
Delta compression using up to 4 threads
Compressing objects: 100% (60/60), done.
Writing objects: 100% (67/67), 3.72 MiB | 421.00 KiB/s, done.
Total 67 (delta 21), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Clearing cached dependencies
remote: -----> Installing python-3.6.10
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: Sqlite3 successfully installed.
remote: -----> Installing requirements with pip
remote:        ERROR: Could not find a version that satisfies the requirement apturl==0.5.2 (from -r /tmp/build_d533b9574fcab74e6906cdc8732269b2/requirements.txt (line 1)) (from versions: none)
remote:        ERROR: No matching distribution found for apturl==0.5.2 (from -r /tmp/build_d533b9574fcab74e6906cdc8732269b2/requirements.txt (line 1))
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to naqviblog.
remote: 
To https://git.heroku.com/naqviblog.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/naqviblog.git'

打开此链接时https://git.heroku.com/naqviblog.git 然后在浏览器上显示

Method Not Allowed

【问题讨论】:

    标签: django heroku pip python-3.7 heroku-cli


    【解决方案1】:
    • 有很多包。您确定您的项目需要所有这些吗?
    • 您添加了 python-3.7 标签,但 Heroku 说它使用的是 python 3.6。确保开发环境和生产环境匹配。
    • apturl 在 PyPI https://pypi.org/ 上不存在。当你运行python -m pip install packagename 时,你会在 PyPI 上搜索它。它在那里不存在。您可能已经通过aptsetup.pywheels等安装了它。

    【讨论】:

    • 哦,但我现在使用的是 python 3.7,它不起作用?不知道,但它是在键入 heroku freeze 时自动生成的,我如何使用 setup.py 或 apt 安装它?
    • 我不知道你是从哪里得到这个包的。我不能告诉你如何安装它。您应该使用 Python 的虚拟环境,并且只安装程序运行所需的包,然后从中生成 requirements.txt。
    猜你喜欢
    • 2019-05-16
    • 2021-05-04
    • 1970-01-01
    • 2015-09-09
    • 2016-07-03
    • 2021-10-21
    • 2016-08-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多