2014-12-02 73 views
1

我正在写Rails应用程序中的第一个红宝石。使用postgres在rails上部署ruby到heroku结果在http 404

本地很棒,我可以访问localhost:3000 /并获取默认登录页面,我可以访问/用户与一个名为User的脚手架对象进行交互。

我为我的分贝使用postgresql,这又在本地工作。

我想将这个项目部署到heroku。我确定git被推送到heroku,这也是,我也跑heroku addons:add heroku-postgresql:development,我也跑heroku run rake db:migrate完成没有输出。

当我访问我的应用程序URL我什么也看不到:https://whats-on-today.herokuapp.com/ Heroku的日志显示404一个http:

2014-12-02T17:03:48.311284+00:00 heroku[router]: at=info method=GET path="/" host=whats-on-today.herokuapp.com request_id=fcb9cc27-e5eb-4760-bc30-8a72fe2f0bbc fwd="195.212.29.67" dyno=web.1 connect=1ms service=10ms status=404 bytes=1829 

我不知道为什么我可以访问根URL http://localhost:3000/本地没问题,在部署到Heroku的我什么也看不见?除404以外的日志中没有什么用处。我部署的http路径是什么?如果它在本地工作,这肯定会起作用吗?

有人可以帮忙吗?

回答

3

您没有定义根路由。试试这样在routes.rb

root 'welcome#index' 

(页欢迎/索引需要明显存在)。 您的应用程序正确部署为https://whats-on-today.herokuapp.com/users清楚地显示。

+0

你提到的PostgreSQL:我通常不添加任何插件,只是下面进入我的Gemfile: #heroku 组:生产做 宝石“PG” 宝石“rails_12factor” 结束 – Johannes 2014-12-02 17:21:20

+0

“的Heroku开”是你需要的而不是那个gui的东西。 – Johannes 2014-12-02 17:26:00

+0

在rails上的ruby文档中没有任何地方postgres是否提到了有关更改我的宝石文件的任何内容? https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres是的,我尝试了你的图标的建议,它也把我带到同一页面 - 404也失败了。 – RenegadeAndy 2014-12-02 17:27:01