Heroku 不从 Pipfile 安装 psycopg2

Heroku does not install psycopg2 from Pipfile

我有一个非常简单的 Flask Python 应用程序 Pipfile. The Pipfile includes "psycopg2" = "*". The app can conntect to the PostgreSQL database when started locally. However it fails on Heroku. It seems Heroku does not install psycopg2 for whatever reasons. I've catpured the logs from a Heroku deployment here

有谁知道先看哪里? 我应该切换回需求文件吗?另外,为什么 yapf 是开发依赖项时安装的?

您的 Heroku 构建输出显示正在从 requirements.txt 安装要求,但没有提及 PipfilePipfile.lock。从 Heroku 的文档中不清楚,但我怀疑 requirements.txt 优先于 Pipfile / Pipfile.lock 如果两者都存在。

删除您的 requirements.txt 文件,提交更改,然后推送回 Heroku,例如

git rm requirements.txt
git commit -m "Remove obsolete requirements.txt"
git push heroku

请注意,这也解释了安装 yapf 的原因:它位于 your requirements.txt file.