简体   繁体   English

Heroku Django 应用程序部署在尝试安装 python 要求后失败

[英]Heroku Django app deployment fails after trying to install python requirement

I installed django-user-visit with pip install django-user-visit , tested it in my local environment and everything seems to work fine, but when i try to deploy my app to production with Heroku i get the following error:我使用pip install django-user-visit ,在我的本地环境中对其进行了测试,一切似乎都正常,但是当我尝试使用Heroku将我的应用程序部署到生产环境时,我收到以下错误:

remote:        Collecting django-cors-headers==3.6.0
remote:          Downloading django_cors_headers-3.6.0-py3-none-any.whl (12 kB)
remote:        ERROR: Could not find a version that satisfies the requirement django-user-visit==0.4.1 (from -r /tmp/build_940d12d0/requirements.txt (line 4)) (from versions: none)
remote:        ERROR: _No matching distribution_ found for django-user-visit==0.4.1 (from -r /tmp/build_940d12d0/requirements.txt (line 4))
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed

Does anyone know why Heroku can't find the package and if i can fix this?有谁知道为什么 Heroku 找不到 package 如果我能解决这个问题?

My packages are being installed by running the libraries indicated in my requirements.txt file:通过运行我的requirements.txt文件中指示的库来安装我的包:

asgiref==3.3.1
Django==3.1.5
django-cors-headers==3.6.0
django-user-visit==0.4.1
djangorestframework==3.12.2
gunicorn==20.0.4
psycopg2==2.8.6
pytz==2020.5
sqlparse==0.4.1
ua-parser==0.10.0
user-agents==2.2.0
whitenoise==5.2.0

What i've tried so far is to change the version to 0.4 and to not specify a version at all到目前为止我尝试的是将版本更改为 0.4 并且根本不指定版本

From the documentation: https://devcenter.heroku.com/articles/python-runtimes来自文档: https://devcenter.heroku.com/articles/python-runtimes

If you're running a Python application that requires a different supported runtime, or if you simply want to lock your project against patch updates until you're ready to upgrade, you can specify which runtime to use for your app.如果您运行的 Python 应用程序需要不同的受支持运行时,或者如果您只是想在准备升级之前锁定项目以防止补丁更新,您可以指定要用于您的应用程序的运行时。

To specify a Python runtime, add a runtime.txt file to your app's root directory that declares the exact version number to use.要指定 Python 运行时,请将runtime.txt文件添加到应用程序的根目录,以声明要使用的确切版本号。

after that在那之后

pip freeze > requirements.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM