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

后端 未结 13 1119
你的背包
你的背包 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:09

    I had a very similiar issue with heroku, found the answer from this question:

    RefineryCMS routes for Home page doesn't work

    To save you reading, the solution was to update "Home" using Advanced Options, there is a question:

    "Forward this page to another website or page"

    Fill this in with a / and it should work. This sounds a little backwards, as its actually setting /my_page to redirect to "/". But the way to think of it is:

    Refinery pages extension is looking for a page with the url '/' to be the home page. So by telling the page titled "Home" that you want it to have the url '/' you're setting it as the definitive homepage as far as Refinery pages extension is concerned. (quote from @Philip Arndt)

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

    I know it's an old problem but I ran into it too. I realized I didn't change the root route in config/routes.rb before pushing. Not changing it might result in a welcome page locally, but on heroku it will get the above error.

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

    I was facing the same error because I pushed same non-master branch to heroku master using this command git push heroku master . Which obviously cause conflicts.

    I also checked the routes using heroku run rake routes. But the output was not my actual routes. Not even single one.
    The proper way to push your non-master branch to heroku master is

    git push -f heroku your_branch_name:master

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

    So I had to run in this order and it worked for me

    $ heroku rake db:migrate
    $ heroku run rake db:setup
    
    0 讨论(0)
  • 2020-12-24 07:21

    I got the same problem; however, after changing 1 line code of production.rb located in config/environments/production.rb from

    config.assets.compile = false
    

    to

    config.assets.compile = true
    

    commit the new change. Then my sample app works fine on heroku

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

    1. Always set a root in routes. That's rails 101

    I wouldn't go for making asset pre-compilation false all the time. For production app I feel it enhances the overall speed if assets have been pre-compiled.

    2. As a rule of thumb I always run rake assets:precompile before pushing to git. Please try it. and then commit to git repository and then heroku. Do heroku restart

    3. Another cause could be heroku rake db:migrate, please check if you did it

    4. Also this is my Gemfile setup for the development and production groups

    group :development do 
        gem 'sqlite3'        
    end
    
    group :production do    
        gem 'pg'
        gem 'rails_12factor'
        gem 'heroku-deflater'   
    end
    
    0 讨论(0)
提交回复
热议问题