【问题标题】:Heroku python app failing to build when installing sqlite3安装 sqlite3 时 Heroku python 应用程序无法构建
【发布时间】:2019-11-02 17:54:16
【问题描述】:

我在 Heroku 上的 Python 应用未能始终如一地构建:

-----> Python app detected
 !     Python has released a security update! Please consider upgrading to python-3.6.8
       Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> Found python-3.6.4, removing
-----> Installing python-3.6.7
-----> Installing pip
-----> Installing SQLite3
 !     Push rejected, failed to compile Python app.
 !     Push failed

这是一个在本地运行良好的 Django 应用程序。

runtime.txt中指定了python-3.6.7,其他版本我也试过了。

我的Procfile 包含:


release: python <appname>/manage.py migrate
web: python <appname>/manage.py runserver 0.0.0.0:$PORT

我可能会使用gunicorn,但这在这里无关紧要。构建日志似乎没有为我提供任何信息。

requirements.txt

chardet==3.0.4
Django==2.0.2
idna==2.6
pytz==2018.3
requests==2.18.4
urllib3==1.22
dj-database-url==0.5.0
setuptools==1.0.0

【问题讨论】:

  • 看起来你已经知道不要在生产中使用manage.py runserver。按照您的建议,一旦您的应用程序正常工作,迁移到 gunicorn 或类似网站可能是个好主意。
  • 我已经向 heroku 团队提出了担忧,并怀疑 15 小时前为 SQLite 发布的新安全补丁导致了问题I've been taking a look and I see that a new version of the SQLite3 package for Xenial was released 15 hours ago with some security fixes. This package is installed by the Python buildpack, and I think this could be related to the installation errors in the build.
  • 我设法通过分叉 heroku buildpack 并注释掉安装 sqlite3 的部分并替换官方 buildpack 来构建我们的应用程序。我们只是运行了一些 python 脚本,所以我什至不知道它为什么要安装 SQLite3....github.com/econner/heroku-buildpack-python
  • @EricConner 感谢您分享您的修复。能够使用 PR 中的更改进行验证和部署。
  • @EricConner 看起来他们正在为此推出一些更改:github.com/heroku/heroku-buildpack-python/pull/825 通过向 app.json 添加配置变量

标签: python sqlite heroku


【解决方案1】:

在你的 app.json 中试试这个。虽然这是一个临时解决方案

"buildpacks": [
    {
      "url": "https://github.com/heroku/heroku-buildpack-python.git#remove- 
              sqlite"
    },

【讨论】:

【解决方案2】:

见:https://travis-ci.org/heroku/heroku-buildpack-python

升级堆栈从heroku-16heroku-18app.json

【讨论】:

  • 回答问题就行了,不需要像Hi i was facing the same problem这样在上面提到额外的评论,尽量让答案简短明了
猜你喜欢
  • 2016-08-12
  • 2020-10-26
  • 1970-01-01
  • 2018-12-24
  • 2019-01-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-14
相关资源
最近更新 更多