我正在尝试将我的代码推送到heroku,但反复收到错误,无法推送一些参考文献,并且没有其他错误消息

问题描述 投票:0回答:1
remote: Verifying deploy...
remote: 
remote: !   Push rejected to college-compass.
remote: 
To https://git.heroku.com/college-compass.git
[remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/college-compass.git'

首先,我在使用gunicorn时遇到错误,但它在我的

requirements.txt
中,并且我的procfile已使用网络正确设置:
gunicorn app:app

此外,当我尝试运行 heroku run bash 时,它看不到我下载的任何软件包,甚至是 python 并说找不到命令。

我的构建日志看起来不错,我的代码具有正确的结构,包括使用 python 3.11.10 的

Procfile
requirements.txt
runtime.txt
,我的
flask
应用程序在
app.py
中定义。

我认为我的 Heroku 路径和我的代码可能不同,但我不确定如何解决这个问题。

我尝试在终端本地运行它并且它可以工作,但由于某种原因它在heroku上不断失败。

我尝试推动我的虚拟环境然后关闭。
我使用了 heroku python buildpack 与社区 apt one 相结合。我尝试清除缓存并强制推送。
我关闭了 heroku 的维护模式。这些都不起作用。

这些是我的日志

2024-10-14T01:00:36.000000+00:00 app[api]: 
Build started by 
user [email protected]
2024-10-14T01:03:50.457347+00:00 heroku[web.1]: 
State changed from crashed to starting
2024-10-14T01:03:53.190899+00:00 heroku[web.1]: 
Starting process with command `gunicorn app:app`
2024-10-14T01:03:53.735153+00:00 app[web.1]: 
/bin/bash: line 1: gunicorn: command not found
2024-10-14T01:03:53.784052+00:00 heroku[web.1]: 
Process exited with status 127
2024-10-14T01:03:53.809774+00:00 heroku[web.1]: 
State changed from starting to crashed
2024-10-14T01:04:25.000000+00:00 app[api]: Build failed -- 
check your build output: https://dashboard.heroku.com/apps/99d1b65f-07e2-4dfa-a964-781a10a1efb6/activity/builds/2b99e226-0ce8-49af-a94a-905ba1568b65
2024-10-14T01:17:35.000000+00:00 app[api]: 
Build started by user [email protected]
2024-10-14T01:21:33.000000+00:00 app[api]: 
Build failed -- check your build output:
https://dashboard.heroku.com/apps/99d1b65f-07e2-4dfa-a964-781a10a1efb6/activity/builds/e4bd7d7a-ae18-4085-a649-be4219b61018
python-3.x git heroku deployment
1个回答
0
投票

问题与

git

无关
  • 由于以下错误,您的构建 (CI) 无法工作:

    >>> gunicorn: command not found
    
    ---
    
    2024-10-14T01:03:53.735153+00:00 app[web.1]: 
    /bin/bash: line 1: gunicorn: command not found
    

您尚未安装

gunicorn

如何解决:

  1. $ pip install gunicorn
  2. gunicorn
    添加到您的要求.txt
© www.soinside.com 2019 - 2024. All rights reserved.