首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >推送到heroku的应用程序仍显示标准索引页面

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

Stack Overflow用户
提问于 2011-06-15 07:01:51
回答 2查看 6.9K关注 0票数 17

我完成了安装git和heroku gem的步骤,并成功地将我的应用程序推送到heroku。问题是,它显示了一个标准的“You‘’re Ruby on Rails”页面,即使我的本地应用程序设置了指向某个控制器/页面的根路径。我还从/public中删除了index.html页面。

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

编辑:由于某些原因,转到mysite.heroku/login和我创建的其他页面工作得很好,所以不要管部署的事情。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-06-15 08:23:21

当您使用git并删除一个文件时,该文件不会自动从git存储库中删除。因此,当你使用git push heroku时,这个文件仍然存在,并且会被推送到Heroku。

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

代码语言:javascript
复制
# 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。在这种情况下,您需要执行以下操作:

代码语言:javascript
复制
git rm public/index.html
git commit -m "Removed public/index.html"

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

现在当你这样做的时候

代码语言:javascript
复制
git push heroku

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

票数 40
EN

Stack Overflow用户

发布于 2011-06-15 22:49:41

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

编辑:此外,当您有新文件要添加时,请确保使用git add .

所以,我的过程是:

代码语言:javascript
复制
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)
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6351182

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档