【发布时间】: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 添加配置变量