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

标签 python django heroku pip

我使用 pip install django-user-visit 安装了 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

有谁知道为什么 Heroku 找不到该软件包以及我是否可以解决这个问题?

我的软件包正在通过运行我的 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

到目前为止我尝试的是将版本更改为 0.4 并且根本不指定版本

最佳答案

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

如果您运行的 Python 应用程序需要不同的受支持运行时,或者您只是想锁定项目以防止补丁更新,直到准备好升级,则可以指定应用程序使用哪个运行时。

要指定 Python 运行时,请将 runtime.txt 文件添加到应用的根目录,该文件声明要使用的确切版本号。

之后

pip freeze > requirements.txt

关于python - Heroku Django 应用程序部署在尝试安装 python 要求后失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65838485/

相关文章:

python - 如何将编码的unicode转换为可读的unicode

javascript - Heroku - headless (headless) Chrome - 连接被拒绝

Python 等效于 phpinfo()

python - 遍历文件结构Python的最有效方法

django - 如何使用 Django channel 进行 HTTP 长轮询

python - Google Cloud App Engine 中的 Django : ImportError: No module named 'src'

python - 使用 numpy 数组左移 1

c++ - 从 C++ 解析 Python 代码

postgresql - 当我尝试在 Cedar Stack 上将我的 SQLite3 推送到 Postgresql(通过 Taps)时,为什么会出现此错误?

php - 如何在 Heroku 上部署 Laravel 4 应用程序?