推送到heroku的应用程序仍显示标准索引页面
我完成了安装git和heroku gem的步骤,并成功将我的应用程序推送到了heroku。 问题是,它显示了一个标准的“你正在使用Ruby on Rails”页面,即使我所拥有的本地应用程序已将路由设置为root到某个控制器/页面。 我还从/ public删除了index.html页面。
知道为什么会这样吗? 我怀疑我可能需要以某种方式从开发切换到部署,但仍然,我删除了index.html,为什么它仍然出现在heroku上?
编辑:转到mysite.heroku /登录和我创建的其他页面由于某种原因工作正常,所以没关注部署的事情。
当您使用git并删除文件时,该文件不会自动从git repo中删除。 所以当你git push heroku
,文件仍然存在并被推送到Heroku。
您可以判断git status
是否属于这种情况,它将显示如下内容:
# Changes not staged for commit: # (use "git add/rm ..." to update what will be committed) # (use "git checkout -- ..." 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中指定的控制器。
我总是使用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)
- Herit,Heroku:预收到钩子拒绝了
- Git bash chcp windows7编码问题
- 在windows上开发,在heroku上运行独角兽
- ExecJS :: ProgramError:意外的令牌:名称(选项)
- 未定义的局部变量或Gemfile的方法`git_source’
- 如何在不泄露应用程序的密钥和凭据的情况下打开源我的Rails应用程序
- 推送到Heroku时:应用程序中发生错误,无法提供您的页面。 请稍后重试
- Grit的克隆方法未定义?
- ExecJS :: RuntimeError:SyntaxError:意外的标记:operator(>)(行:22342,col:24,pos:826182)