【问题标题】:Heroku Python Deployment Version IssueHeroku Python 部署版本问题
【发布时间】:2022-01-25 15:31:07
【问题描述】:

Heroku 不会为我的 Django 应用推送我的 Python 版本,我不知道为什么...我将我的 python 从 3.8.7 升级到 3.10.2 并将其反映在 runtime.txt 文件中,以及更改已明确添加,但这似乎不起作用。

来自 heroku 的 Python 支持:

Supported runtimes
python-3.10.2 on all supported stacks
C:\Users\New User\Downloads\django-modal-ajax-crud-main\django-modal-ajax-crud-main>git push heroku main
Enumerating objects: 191, done.
Counting objects: 100% (191/191), done.
Delta compression using up to 4 threads
Compressing objects: 100% (173/173), done.
Writing objects: 100% (191/191), 72.21 MiB | 1.24 MiB/s, done.
Total 191 (delta 35), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote:  !     Requested runtime ("python-3.10.2") is not available for this stack (heroku-20).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to whispering-oasis-59527.
remote:
To https://git.heroku.com/whispering-oasis-59527.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/whispering-oasis-59527.git'

【问题讨论】:

  • 我会开一张 Heroku 支持票。这似乎是一个错误。
  • 你的runtime.txt UTF-8 编码了吗?
  • 不管它是如何编码的,heroku 正在接收正确的请求,因为它在错误中字面意思是 Requested runtime ("python-3.10.2")。旁注:标签git 在这里不适用。您正在使用 Git 存储您的存储库要求 Heroku 构建,但 Git 并没有参与产生您在此处看到的任何错误:它只是在传递东西 来自 Heroku。
  • @RCarmody,另外,该文件使用什么行尾?
  • 我有类似的东西,我不得不使用以下命令对其进行更多调试。这不是一个答案,但也许它可以帮助你更接近?注意:由于我的收集静态阶段,我遇到了这个错误。 heroku 配置:设置 DEBUG_COLLECTSTATIC=1

标签: python django heroku


【解决方案1】:

我现在真的用3.10.2 部署了,所以它可用

所以,你的问题似乎有一个错误的错误,在你的输出末尾解释了

Requested runtime ("python-3.10.2") is not available for this stack (heroku-20).
...
.. (pre-receive hook declined)

docker documentaion 说:

runtime.txt 格式区分大小写,不得包含空格。 您还必须指定所有三个版本号组件(主要、 次要和补丁)在 runtime.txt 中。

如果您不遵循此格式,您的应用将无法部署。

所以请确保没有空格或换行,并始终跟踪supported runtimes


另外

你可以删除runtime.txt

app.json 应在关键字中包含带有 no versionpython"image": "heroku/python"

然后使用默认版本安装当前3.9.10

然后你可以用runtime.txt更新


首先:确保您的应用在本地机器上正常运行

这也可能是这样的依赖错误first comment on this answer

您的应用程序和构建依赖项在部署时应该可以正常工作

【讨论】:

    猜你喜欢
    • 2018-03-19
    • 1970-01-01
    • 2018-08-28
    • 2022-11-08
    • 2017-02-08
    • 2015-06-05
    • 1970-01-01
    • 1970-01-01
    • 2016-05-11
    相关资源
    最近更新 更多