[英]Heroku Rails Setup “The page you were looking for doesn't exist.”
I'm following this Rails tutorial . 我正在关注这个Rails教程 。 When I run rails server locally, I can see the "Welcome Aboard" page. 当我在本地运行rails服务器时,我可以看到“Welcome Aboard”页面。 However, when deploying to Heroku, it shows "The page you were looking for doesn't exist." 但是,在部署到Heroku时,它会显示“您正在查找的页面不存在”。 I've searched around but couldn't find anything to solve my problem. 我已经四处寻找,但找不到任何可以解决我问题的方法。 Below are my steps: 以下是我的步骤:
rails new first_app
Make this change to Gemfile: 对Gemfile进行此更改:
group :production do
gem 'pg'
end
group :development do
gem 'sqlite3'
end
Then, 然后,
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
At this point it opens the address for the heroku app and gives the "doesn't exist" error. 此时,它会打开heroku应用程序的地址,并显示“不存在”错误。 When checking 'heroku logs' it shows the status=404 of my visit: 检查'heroku logs'时,它显示我访问的状态= 404:
Beginning in Rails 4, the "Welcome Aboard" page is no longer a static page located in the public
directory, it is a smoke page located within the Rails framework itself. 从Rails 4开始,“Welcome Aboard”页面不再是位于public
目录中的静态页面,它是位于Rails框架内部的烟雾页面。 This page will only be shown in the development mode, so when you've deployed to Heroku and are running in production
mode, you won't get an automatic start page. 此页面仅在开发模式下显示,因此当您部署到Heroku并在production
模式下运行时,您将无法获得自动启动页面。 You'll need to add a root
route otherwise you'll get the error you are seeing. 您需要添加root
路由,否则您将收到您看到的错误。
see: Where is the default "Welcome Aboard" page located in my app? 请参阅: 我的应用程序中默认的“欢迎登机”页面在哪里?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.