我正在尝试部署一个简单的django应用程序,并已成功将我的git存储库推送到Heroku。但是,当我尝试运行时:
heroku ps:scale web=1
我收到以下错误
Scaling dynos... failed
! Couldn't find that formation.
有关问题可能是什么的任何想法?根据我的知识,Procfile(下面)的内容是正确的。
web: gunicorn my_app_name.wsgi
答案 0 :(得分:20)
说明显而易见:遇到此问题的另一种方法是,如果您正在使用新应用,并且在实际执行/api/users/230
之前尝试运行heroku ps:scale web=1
。在这种情况下,Heroku服务器上没有git push heroku master
,因为根本没有任何文件。 :d
答案 1 :(得分:14)
确保您的Procfile没有扩展名。
要在Windows上创建没有扩展名的文件,可以从命令行使用命令notepad Procfile.
。
答案 2 :(得分:11)
要添加另一个可能发生的原因,我的Procfile
包含
web:gunicorn
但它应该是:
web: gunicorn
据我所知,如果你遇到这个问题,如果你遇到这个问题,很可能与Procfile
有关。
答案 3 :(得分:7)
对于那些感兴趣的人,我有同样的问题来添加一个工人。为此,您需要将此行添加到procfile:worker: python worker.py
答案 4 :(得分:3)
对于遇到同样问题的其他人,请确保在git中不会忽略Procfile。
删除您的Procfile。然后是git status
。如果没有提到Procfile,你需要找到从本地或全球.gitignore中删除的条目。
答案 5 :(得分:1)
我遇到了同样的问题,因为我错过了git add
和git commit
名为Procfile的文件。
您应该尝试使用git status
命令并查看是否包含Procfile
。
答案 6 :(得分:1)
我在处理windows
时遇到过类似的问题(在其他操作系统上没有经过测试),这对我来说很合适。
最初,我创建了一个文件名procfile
并将其推送到heroku。但是,heroku期待Procfile
声明。它是case sensitive
。因此,我们应该在typing the filename also
时小心。
即使将名称更改为Procfile
,git也没有注意到更改(也许git就像Windows一样不区分大小写)。因此,我必须完全删除文件,并且必须使用Procfile
作为文件名创建一个新文件。
答案 7 :(得分:1)
答案 8 :(得分:0)
在我的php项目中,我可以使用
$ heroku ps:scale web=1
在heroku目录“php-getting-started”(https://devcenter.heroku.com/articles/getting-started-with-php#prepare-the-app)。
所以我尝试在原始应用程序中执行此操作,因此我尝试在Heroku存储库中再次执行此操作。
(抱歉英语,呵呵)
答案 9 :(得分:0)
我有同样的问题,
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
问题已解决
答案 10 :(得分:0)
我遇到了类似的问题,并尝试了以下方法:
最终,我意识到我的Procfile位于我的应用目录中。它应该在根目录/项目目录中。