无法将初始 Flask 应用程序部署到 Heroku "no Cedar-supported app detected",与 Foreman 一起工作

Can't deploy initial Flask app to Heroku "no Cedar-supported app detected", works with Foreman

我在将 Flask 应用程序部署到 Heroku 时遇到问题。我已经在 Heroku 上成功创建了该应用程序,它在本地与 Foreman 一起运行良好,我的 Procfile 正确(我认为)并且我的 requirements.txt 在目录的根目录中。我仍然需要设置环境变量并连接到我正在使用的 AWS RDS Postgres 数据库,但我什至还没有完成。我对 Heroku 的初始推送一直失败。

这是我尝试 git push herok master:

的错误
Counting objects: 219, done.  
Delta compression using up to 4 threads.  
Compressing objects: 100% (206/206), done.  
Writing objects: 100% (219/219), 274.75 KiB | 0 bytes/s, done.  
Total 219 (delta 98), reused 0 (delta 0)  
remote: Compressing source files... done.  
remote: Building source:  
remote:  
remote:  
remote:  !     Push rejected, no Cedar-supported app detected  
remote: HINT: This occurs when Heroku cannot detect the buildpack  
remote:       to use for this application automatically.  
remote: See https://devcenter.heroku.com/articles/buildpacks  
remote:  
remote: Verifying deploy... 

remote:  
remote: !   Push rejected to my-awesome-app.  
remote:  
To https://git.heroku.com/my-awesome-app.git` 

这是我的 Procfile:

web: gunicorn app:app --log-file=-

这是我的文件结构:

\project  (git root directory)
   Procfile
   requirements.txt
   [...other files...] 
    run.py
    \venv
    \etl  
    \app
     [...other files...]  
      \static  
      \templates  

我环顾四周,没有找到任何帮助。

如果有帮助,很乐意添加任何其他信息。这很令人沮丧!

在您存储库的根目录中,键入:

echo "python-2.7.10" > runtime.txt

如果您使用的是不同版本的 Python,请参阅 this article 了解支持的运行时。

runtime.txt 添加到您的 git 存储库并推送到 heroku。它应该强制它将您的应用程序检测为 Python 应用程序。

我想通了,这是我的错误。我的 .gitignore 中有 *.txt,但没有意识到我没有 adding/committing requirements.txt git 存储库。这...解释了为什么 heroku 找不到它!