推送到heroku的应用程序仍然显示标准索引页面

时间:2011-06-14 23:01:51

标签: ruby-on-rails ruby git deployment heroku

我完成了安装git和heroku gem的步骤,并成功将我的应用程序推送到了heroku。 问题是,它显示了一个标准的“你正在使用Ruby on Rails”页面,即使我所拥有的本地应用程序已将路由设置为root到某个控制器/页面。我还从/ public删除了index.html页面。

知道为什么会这样吗?我怀疑我可能需要以某种方式从开发切换到部署,但仍然,我删除了index.html,为什么它仍然出现在heroku上?

编辑:转到mysite.heroku / login和我创建的其他页面由于某种原因可以正常工作,所以不要对部署事情进行处理。

2 个答案:

答案 0 :(得分:40)

当您使用git并删除文件时,该文件不会自动从git repo中删除。所以当你git push heroku文件仍然存在并被推送到Heroku时。

您可以判断git status是否属于这种情况,它会显示如下内容:

# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    public/index.html

要删除该文件,您需要使用git rm。在这种情况下,您需要执行以下操作:

git rm public/index.html
git commit -m "Removed public/index.html"

将从当前分支中删除该文件。

现在你做的时候

git push heroku

该文件不会被包含,因此您将被路由到routes.rb中指定的控制器。

答案 1 :(得分:2)

我总是使用git commit -am“message”。这阻止了上述问题(这肯定会发生),我不知道有什么理由不使用-am。

编辑:另外,当您要添加新文件时,请务必使用git add .

所以,我的过程是:

git status (to see what has changed)
git add . (if there are new files I want to add to repository)
git commit -am "This is the comment"
git push (to github)
git push heroku (--app app-name if there is more than one app connected to this repository)