【发布时间】:2014-02-25 21:21:55
【问题描述】:
我正在关注this Rails tutorial。当我在本地运行 rails server 时,我可以看到“Welcome Aboard”页面。但是,在部署到 Heroku 时,它显示“您要查找的页面不存在”。我四处寻找,但找不到任何可以解决我的问题的东西。以下是我的步骤:
rails new first_app
对 Gemfile 进行此更改:
group :production do
gem 'pg'
end
group :development do
gem 'sqlite3'
end
那么,
bundle update
bundle install
bundle install --without production
rake assets:precompile
git init
git add .
git commit -m "initial commit"
heroku login
heroku create
git push heroku master
heroku open
此时它会打开 heroku 应用程序的地址并给出“不存在”错误。检查“heroku 日志”时,它显示我访问的 status=404:
【问题讨论】:
-
应用部署成功了吗?
-
@archie 它说shrouded-brook-5034.herokuapp.com 已部署到 Heroku。虽然有一些警告。例如,“包含 rails_12factor geme 以启用所有平台功能”、“您尚未在 Gemfile 中声明 Ruby 版本”、“删除 Gemfile.lock,因为它是在 Windows 上生成的”。
-
我在 group :production 中加入了 gem 'rails_12factor' 并进行了包更新/安装并再次推送到 Heroku。它没有影响任何东西,但警告消失了。
-
您的
rake routes输出是什么样的?你在某个地方有root to:吗? -
如果您没有定义任何路线,则会显示默认的“欢迎登机”页面。我不确定 Heroku 是否有相同的行为。
标签: ruby-on-rails heroku