Heroku Rails设置"您正在寻找的页面不存在。"

时间:2014-02-25 21:21:56

标签: ruby-on-rails heroku

我正在关注this Rails tutorial。当我在本地运行rails服务器时,我可以看到“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 logs'时,它显示我访问的状态= 404: heroku logs

1 个答案:

答案 0 :(得分:37)

从Rails 4开始,“Welcome Aboard”页面不再是位于public目录中的静态页面,它是位于Rails框架内的烟雾页面。此页面仅在开发模式下显示,因此当您部署到Heroku并以production模式运行时,您将无法获得自动启动页面。您需要添加root路线,否则您将收到您所看到的错误。

请参阅:Where is the default "Welcome Aboard" page located in my app?