Cloud9, GitHub and Heroku (The page you were looki

2019-09-08 09:01发布

I'm new to Ruby on Rails. I'm usin: / Cloud9 to make the ROR application / GitHub to store the files and update them / Hiroku for the production as a free service

When I run the application on Cloud9, it works properly: https://ruby2016-bbparis.c9users.io/

When I push it to GitHub, it doesn't work on Heroku, and I get :

The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. If you are the application owner check the logs for more information.

capture screen

My route file is so simple :

Rails.application.routes.draw do

  root 'pages#home'

  get 'pages/about', to: 'pages#about'

end

How can I resolve this issue please ?

1条回答
放荡不羁爱自由
2楼-- · 2019-09-08 09:54

I assume you already have heroku repository created. Try following command and it should work as your app works perfectly on c9

$ bundle update 

$ heroku run rake db:migrate

$ heroku run rake db:schema:load

$ git init

$ git add .

$ git commit -am "some comment"

$ git push heroku master

$ git push heroku master

$ heroku open

I know your page doesn't have even database yet. I had similar problem in past and it helped me to resolve same problem.

run rake db:schema:load basically load your schema into current environment's database. rake db:migrate does migration for current environment which not run yet for more info on rake db commands follow this

It is recommended to use postgres database in heroku because of tight integration with platform however there are many option for application currently running on MySQL. For more information on how you can migrate to postgres click here.

查看更多
登录 后发表回答