【问题标题】:How to overcome 'Coudn't find that formation' error when adding web dynos to Heroku django app?将网络测功机添加到 Heroku django 应用程序时如何克服“无法找到该编队”错误?
【发布时间】:2015-10-07 20:45:19
【问题描述】:

我正在尝试部署一个简单的 django 应用程序,并已成功将我的 git 存储库推送到 Heroku。但是,当我尝试运行时:

heroku ps:scale web=1

我收到以下错误

Scaling dynos... failed
 !    Couldn't find that formation.

关于问题可能是什么的任何想法?据我所知,Procfile(如下)的内容是正确的。

web: gunicorn my_app_name.wsgi

【问题讨论】:

  • git push 后heroku ps 的输出是什么?
  • 没有输出。终端看起来像是在做几秒钟,然后提示回来了。
  • 很奇怪。 Web UI 是否提供任何信息:它应该显示您当前的配置/测功机计数(如果有)。
  • 在“Dynos”下它只是说“No dynos”。我不确定是否有一个选项可以通过网络界面控制测功机的数量,但没有出现。
  • 啊——发现问题了,有点尴尬。我会发布一个答案。

标签: django heroku


【解决方案1】:

确保您的 Procfile 没有扩展名。

要在 Windows 上创建没有扩展名的文件,您可以在命令行中使用命令 notepad Procfile.

【讨论】:

    【解决方案2】:

    对于遇到同样问题的其他人,请确保 Procfile 在 git 中未被忽略。

    删除您的 Procfile。然后git status。如果没有看到任何提及 Procfile 的内容,则需要从本地或全局 .gitignore 中删除条目。

    【讨论】:

      【解决方案3】:

      对于那些感兴趣的人,我在添加工人时遇到了同样的问题。为此,您需要将此行添加到您的 procfile 中:worker: python worker.py

      【讨论】:

        【解决方案4】:

        明确地说:遇到此问题的另一种方法是,如果您正在开发一个新应用程序,并且在实际执行 git push heroku master 之前尝试运行 heroku ps:scale web=1。在这种情况下,Heroku 服务器上没有Procfile,因为根本没有任何文件。 :D

        【讨论】:

        • 为我工作。 :)
        【解决方案5】:

        添加另一个可能发生这种情况的原因,我的Procfile 包含

        web:gunicorn 
        

        但应该是:

        web: gunicorn
        

        据我从所有这些答案中得知,如果您遇到此问题,很可能与Procfile 有关。

        【讨论】:

        • 好眼光。如果我没有阅读这篇文章,我可能需要一段时间才能发现这一点
        • 这对我有用。花了很多时间做许多其他选项,就是这样,在我更改文件后,dynos 立即缩放。
        【解决方案6】:

        在我的php项目中我可以使用

        $ heroku ps:scale web=1
        

        在 heroku 目录“php-getting-started”(https://devcenter.heroku.com/articles/getting-started-with-php#prepare-the-app)。

        所以我尝试在我的原始应用程序中执行此操作,因此我尝试在 Heroku Repository 中再次执行此操作,并且成功了。

        (对不起英文,呵呵)

        【讨论】:

          【解决方案7】:

          我遇到了同样的问题,因为我错过了 git addgit commit 名为 Procfile 的文件。

          您应该尝试使用命令git status 并查看是否包含Procfile

          【讨论】:

            【解决方案8】:

            我在使用 windows 时遇到了类似的问题(尚未在其他操作系统上测试过),这对我来说很好。

            最初,我创建了一个文件名procfile 并将其推送到heroku。但是,heroku 需要 Procfile 声明。它是case sensitive。因此,我们在typing the filename also时要小心。

            即使将名称更改为Procfile git 也没有注意到更改(也许 git 像 windows 一样不区分大小写)。因此,我不得不彻底删除该文件,并以Procfile 作为文件名创建一个新文件。

            【讨论】:

              【解决方案9】:

              当推送到 Heroku 时,你必须想出如图所示的东西。如果不是,您的 procfile 有错误。 我的 Flask 应用程序的 Procfile 看起来像这样

              web: gunicorn app:app
              

              【讨论】:

                【解决方案10】:

                我遇到了同样的问题,

                1) 我还配置了 ProcFile 但问题仍然存在

                所以用了这个

                Remove the existing buildpacks with heroku buildpacks:clear and add them again in the right order using the heroku buildpacks:add with the --index option, making sure that the language buildpack is the last in the list

                git commit --allow-empty -m "Adjust buildpacks on Heroku"
                git push heroku master
                

                问题解决了

                【讨论】:

                  【解决方案11】:

                  我遇到了类似的问题并尝试了以下方法:

                  • 确保 Procfile 没有任何扩展名
                  • Procfile 的拼写与“Procfile”完全相同

                  最后才意识到我的 Procfile 在我的应用程序目录中。它应该在根/项目目录中。

                  【讨论】:

                    猜你喜欢
                    • 2016-02-08
                    • 2018-04-21
                    • 1970-01-01
                    • 2021-05-10
                    • 2020-12-25
                    • 2019-12-05
                    • 1970-01-01
                    • 2012-11-26
                    • 2013-04-04
                    相关资源
                    最近更新 更多