问题描述
我是Ruby on Rails的新手。我是usin:
/ Cloud9使ROR应用程序
/ GitHub存储文件并更新它们
/ Hiroku作为免费服务制作
当我在Cloud9上运行应用程序时,它可以正常工作:
当我将它推送到GitHub时,它在Heroku上不起作用,我得到:
您正在查找的网页不存在。
您可能错误地址或页面可能已经移动。
如果您是应用程序所有者,请查看日志以获取更多信息。
pre>
Rails.application.routes.draw do
root'pages#home'
get'pages / about',to: 'pages#about'
end
请问如何解决此问题?
我假设您已经创建了heroku存储库。
试试下面的命令,它应该可以在你的应用程序在c9上完美工作
$ bundle update
$ heroku run rake db:migrate
$ heroku run rake db:schema:load
$ git init
$ git add。
$ git commit -am一些评论
$ git push heroku大师
$ git push heroku大师
$ heroku open
我知道您的网页还没有数据库。过去我遇到过类似的问题,它帮助我解决了同样的问题。
运行 rake db:schema:load
基本上将您的模式加载到当前环境的数据库中。 rake db:migrate
为当前环境迁移,但尚未运行rake db命令的更多信息,请参阅
建议使用 postgres
数据库,因为与平台紧密集成,但是当前在
MySQL
上运行的应用程序有很多选项。有关如何迁移到 postgres
。
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.
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 ?
解决方案 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.
这篇关于Cloud9,GitHub和Heroku(您正在寻找的页面不存在。)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!