RefineryCMS routes for Home page doesn't work

2019-07-04 16:51发布

问题:

just started with RefineryCMS, sorry for newbie question. It runs fine locally and deployed luckily on Heroku Cedar stack. Created a page called Home. /pages/home responds fine.

routes.rb

root :to => 'pages#home'

and works on localhost:3000 but on Heroku it gives error.

The app is here:

http://refkocedar.herokuapp.com/home works http://refkocedar.herokuapp.com/ does not work

How to set Home page to root on Heroku? Thanks for help!

$ heroku logs

2012-04-03T02:19:57+00:00 heroku[router]: GET refkocedar.herokuapp.com/assets/application-ddce3db0fc667014faf95d85d24c71d4.js dyno=web.1 queue=0 wait=0ms service=4ms status=304 bytes=0
2012-04-03T02:19:58+00:00 heroku[router]: GET refkocedar.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=4ms status=304 bytes=0
2012-04-03T02:19:58+00:00 app[web.1]: cache: [GET /favicon.ico] miss
2012-04-03T02:20:04+00:00 app[web.1]: 
2012-04-03T02:20:04+00:00 app[web.1]: 
2012-04-03T02:20:04+00:00 app[web.1]: Started GET "/" for 80.98.142.244 at 2012-04-03 02:20:04 +0000
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss
2012-04-03T02:20:04+00:00 app[web.1]: cache: [GET /] miss

回答1:

I was trying Refinery recently on myocal workspace and had a similar issue. Not sure what is different on heroku as I didnt try anything on it. This solution worked for me.

http://groups.google.com/group/refinery-cms/browse_thread/thread/504b72ec2f1575d5



回答2:

Refinery admin page you have a option as "forward this page" under advanced options. Set "/"

Here I explain step by step how to set up your home as root_path(localhost:3000).

go to http://localhost:3000/refinery/login

1.Then Login with your username and password.

2.Click to Pages

3.click edit link which page you want to see when localhost:3000 loaded.

4.Click Advanced Options

5.Set / in Forward this page to another website or page text box. Then click Save

6.Now your home page will show on localhost:3000



回答3:

What Sonu linked to from google groups is correct. You need to add the following in your routes.rb:

root :to => 'pages#home'

And then change the setting on your home page (under advanced settings) that says:

Forward this page to another website or page

and have this forwarded to /

This worked for me.



回答4:

Very short answer. Under "Advanced Options", set "Forward this page to another website or page" to /

It doesn't sound like it should work, but it does.



回答5:

I'd say this is almost certainly an error with your routes.rb file.

I was working through the Rails Tutorial by Michael Hartl to setup my new app and ran into this error over and over again.

Check to make sure that Heroku knows the correct root path e.g. " root 'application#hello'"