Heroku problem : The page you were looking for doesn't exist

后端 未结 13 1121
你的背包
你的背包 2020-12-24 06:43

I have followed book until chapter 5 finished and it\'s working OK in my linux workstation when I push to Heroku, all data pushed correctly but when I try to open Heroku (ht

相关标签:
13条回答
  • 2020-12-24 07:23

    I got the same error but realized that I hadn't change the HTML verb from GET to ROOT in config/routes.rb file.

    It was get "/hello", to: "application#hello"

    I updated it to root "application#hello"

    I then pushed it to git and deployed it to production.

    0 讨论(0)
  • 2020-12-24 07:24

    I had the same problem, but the thing is that the app is missing the home like root. The default home page for Heroku is this HTMLthe default page. But if you try all your defined routes they will work like:

    appname.herokuapp.com/route

    0 讨论(0)
  • 2020-12-24 07:29

    I'm using postgresql, and I also had page not showing up on heroku.

    This command fixed it:

    heroku run rake db:setup
    

    and then

    heroku rake db:migrate
    

    I had migrated before, but hadn't done the setup first.

    I also had tried setting

    config.assets.compile = true
    

    in production.rb, but that made no difference.

    0 讨论(0)
  • 2020-12-24 07:29

    Specify Ruby version in app Rails 5 requires Ruby 2.2.0 or above. Heroku has a recent version of Ruby installed by default, however you can specify an exact version by using the ruby DSL in your Gemfile.

    At the end of Gemfile add:

    ruby "2.4.1"

    0 讨论(0)
  • 2020-12-24 07:30

    Ran into this problem as well. Solved it by setting a root route. In my case, root 'pages#home' in config/routes.rb

    If the root route is not set, you are redirected to localhost:3000. Hence,

    The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.

    0 讨论(0)
  • 2020-12-24 07:32

    Have you tried running in production mode locally? Try rails server -e production and see if you get the same error, which you can then debug. Also make sure you've done heroku rake db:migrate.

    0 讨论(0)
提交回复
热议问题