0

我在 Heroku 上托管了一个 Hacker News 克隆,我克隆了它以进行更改,以便可以按日期和投票计数对投票进行排序。进展顺利,然后我用 rspec 进行了测试,确保我是绿色的。最后,我推送到 Heroku,它也很顺利,没有报告错误。

但是,当我访问该网址时,它显示“我们很抱歉,但出了点问题。”。通常,我会进行故障排除,但部署或 rspec 中没有消息,所以我不确定该怎么做?如果有人遇到过这种情况或可以建议我尝试一些东西,我将不胜感激。这是运行 rspec 和部署后的终端输出:

Finished in 0.60271 seconds
11 examples, 0 failures

Randomized with seed 33033

jasonrodriguez:infinite-castle-2099 jasonrodriguez$ git add . -A
jasonrodriguez:infinite-castle-2099 jasonrodriguez$ git commit -m "verifying that this app is committed"
# On branch master
nothing to commit, working directory clean
jasonrodriguez:infinite-castle-2099 jasonrodriguez$ git push heroku master
Everything up-to-date
jasonrodriguez:infinite-castle-2099 jasonrodriguez$ 

我通过主分支做到了这一点jasonrodriguez:infinite-castle-2099 jasonrodriguez$ git branch * master

我跑了heroku logs --tail,它给了我这个:

jasonrodriguez:infinite-castle-2099 jasonrodriguez$ heroku logs --tail
2013-10-19T17:03:32.558564+00:00 app[web.1]: LINE 1: ...8695' AND '2013-10-19 17:03:32.548861')  ORDER BY votes_coun...
2013-10-19T17:03:32.558717+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:03:32.558717+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:03:32.558717+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:03:32.558717+00:00 app[web.1]: 
2013-10-19T17:03:33.819411+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=infinite-castle-2099.herokuapp.com fwd="67.170.184.10" dyno=web.1 connect=1ms service=11ms status=200 bytes=0
2013-10-19T17:24:26.167584+00:00 app[web.1]: PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:24:26.163272+00:00 app[web.1]: Started GET "/" for 67.170.184.10 at 2013-10-19 17:24:26 +0000
2013-10-19T17:24:26.163272+00:00 app[web.1]: Started GET "/" for 67.170.184.10 at 2013-10-19 17:24:26 +0000
2013-10-19T17:24:26.167584+00:00 app[web.1]:                                                              ^
2013-10-19T17:24:26.167584+00:00 app[web.1]: LINE 1: ...4736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_coun...
2013-10-19T17:24:26.167584+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:24:26.164736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_count DESC LIMIT 100
2013-10-19T17:24:26.167584+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:24:26.164736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_count DESC LIMIT 100
2013-10-19T17:24:26.167584+00:00 app[web.1]: PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:24:26.167584+00:00 app[web.1]:                                                              ^
2013-10-19T17:24:26.168406+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-10-19T17:24:26.170324+00:00 app[web.1]: 
2013-10-19T17:24:26.170324+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:24:26.175677+00:00 heroku[router]: at=info method=GET path=/ host=infinite-castle-2099.herokuapp.com fwd="67.170.184.10" dyno=web.1 connect=2ms service=13ms status=500 bytes=1266
2013-10-19T17:24:26.164068+00:00 app[web.1]: Processing by LinksController#index as HTML
2013-10-19T17:24:26.164068+00:00 app[web.1]: Processing by LinksController#index as HTML
2013-10-19T17:24:26.170324+00:00 app[web.1]:     11:   <tbody class="stories">
2013-10-19T17:24:26.170324+00:00 app[web.1]:                                                              ^
2013-10-19T17:24:26.170324+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:24:26.164736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_count DESC LIMIT 100):
2013-10-19T17:24:26.170479+00:00 app[web.1]:     15:                    <%= f.submit  '▲' %>
2013-10-19T17:24:26.170479+00:00 app[web.1]: 
2013-10-19T17:24:26.168250+00:00 app[web.1]:   Rendered links/index.html.erb within layouts/application (3.6ms)
2013-10-19T17:24:26.170479+00:00 app[web.1]:   app/views/links/index.html.erb:12:in `_app_views_links_index_html_erb___4309851234159801657_70037839513200'
2013-10-19T17:24:26.170626+00:00 app[web.1]:     13:           <%= form_for link.votes.new do |f| %>
2013-10-19T17:24:26.170324+00:00 app[web.1]:     13:           <%= form_for link.votes.new do |f| %>
2013-10-19T17:24:26.170479+00:00 app[web.1]: LINE 1: ...4736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_coun...
2013-10-19T17:24:26.170626+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:24:26.170324+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:24:26.170479+00:00 app[web.1]:                                                              ^
2013-10-19T17:24:26.170626+00:00 app[web.1]:   app/views/links/index.html.erb:12:in `_app_views_links_index_html_erb___4309851234159801657_70037839513200'
2013-10-19T17:24:26.170626+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:24:26.170479+00:00 app[web.1]:     14:                    <%= f.hidden_field :link_id %>
2013-10-19T17:24:26.170626+00:00 app[web.1]:     11:   <tbody class="stories">
2013-10-19T17:24:26.170626+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:24:26.167584+00:00 app[web.1]: LINE 1: ...4736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_coun...
2013-10-19T17:24:26.168489+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-10-19T17:24:26.170324+00:00 app[web.1]: LINE 1: ...4736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_coun...
2013-10-19T17:24:26.170479+00:00 app[web.1]: 
2013-10-19T17:24:26.170479+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:24:26.170626+00:00 app[web.1]:     15:                    <%= f.submit  '▲' %>
2013-10-19T17:24:26.168250+00:00 app[web.1]:   Rendered links/index.html.erb within layouts/application (3.6ms)
2013-10-19T17:24:26.170324+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:24:26.170479+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:24:26.164736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_count DESC LIMIT 100):
2013-10-19T17:24:26.170324+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:24:26.170479+00:00 app[web.1]: 
2013-10-19T17:24:26.170626+00:00 app[web.1]:     14:                    <%= f.hidden_field :link_id %>
2013-10-19T17:24:26.170626+00:00 app[web.1]: 
2013-10-19T17:24:26.170626+00:00 app[web.1]: 
2013-10-19T17:25:15.524381+00:00 app[web.1]: Started GET "/" for 99.90.16.79 at 2013-10-19 17:25:15 +0000
2013-10-19T17:25:15.529687+00:00 app[web.1]:   Rendered links/index.html.erb within layouts/application (3.8ms)
2013-10-19T17:25:15.529083+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:25:15.525998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_count DESC LIMIT 100
2013-10-19T17:25:15.524381+00:00 app[web.1]: Started GET "/" for 99.90.16.79 at 2013-10-19 17:25:15 +0000
2013-10-19T17:25:15.525289+00:00 app[web.1]: Processing by LinksController#index as HTML
2013-10-19T17:25:15.529083+00:00 app[web.1]: PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:25:15.525289+00:00 app[web.1]: Processing by LinksController#index as HTML
2013-10-19T17:25:15.531524+00:00 app[web.1]:                                                              ^
2013-10-19T17:25:15.531695+00:00 app[web.1]: 
2013-10-19T17:25:15.529083+00:00 app[web.1]:                                                              ^
2013-10-19T17:25:15.529083+00:00 app[web.1]: PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:25:15.529083+00:00 app[web.1]: LINE 1: ...5998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_coun...
2013-10-19T17:25:15.529083+00:00 app[web.1]: LINE 1: ...5998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_coun...
2013-10-19T17:25:15.529083+00:00 app[web.1]:                                                              ^
2013-10-19T17:25:15.531695+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:25:15.525998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_count DESC LIMIT 100):
2013-10-19T17:25:15.529798+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-10-19T17:25:15.531841+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:25:15.531841+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:25:15.531841+00:00 app[web.1]: 
2013-10-19T17:25:15.531841+00:00 app[web.1]: 
2013-10-19T17:25:15.529687+00:00 app[web.1]:   Rendered links/index.html.erb within layouts/application (3.8ms)
2013-10-19T17:25:15.529083+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:25:15.525998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_count DESC LIMIT 100
2013-10-19T17:25:15.531841+00:00 app[web.1]:     11:   <tbody class="stories">
2013-10-19T17:25:15.531524+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:25:15.525998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_count DESC LIMIT 100):
2013-10-19T17:25:15.529798+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-10-19T17:25:15.531524+00:00 app[web.1]:     11:   <tbody class="stories">
2013-10-19T17:25:15.531524+00:00 app[web.1]: LINE 1: ...5998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_coun...
2013-10-19T17:25:15.531524+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:25:15.531524+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:25:15.531695+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:25:15.531695+00:00 app[web.1]: LINE 1: ...5998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_coun...
2013-10-19T17:25:15.531524+00:00 app[web.1]: 
2013-10-19T17:25:15.531524+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:25:15.531841+00:00 app[web.1]:   app/views/links/index.html.erb:12:in `_app_views_links_index_html_erb___4309851234159801657_70037839513200'
2013-10-19T17:25:15.531695+00:00 app[web.1]:     14:                    <%= f.hidden_field :link_id %>
2013-10-19T17:25:15.531524+00:00 app[web.1]:     13:           <%= form_for link.votes.new do |f| %>
2013-10-19T17:25:15.531695+00:00 app[web.1]: 
2013-10-19T17:25:15.531695+00:00 app[web.1]:     15:                    <%= f.submit  '▲' %>
2013-10-19T17:25:15.531841+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:25:15.531695+00:00 app[web.1]:   app/views/links/index.html.erb:12:in `_app_views_links_index_html_erb___4309851234159801657_70037839513200'
2013-10-19T17:25:15.531841+00:00 app[web.1]:     13:           <%= form_for link.votes.new do |f| %>
2013-10-19T17:25:15.531524+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:25:15.531695+00:00 app[web.1]: 
2013-10-19T17:25:15.531841+00:00 app[web.1]:     15:                    <%= f.submit  '▲' %>
2013-10-19T17:25:15.531695+00:00 app[web.1]:                                                              ^
2013-10-19T17:25:15.531841+00:00 app[web.1]:     14:                    <%= f.hidden_field :link_id %>
2013-10-19T17:25:16.054820+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=infinite-castle-2099.herokuapp.com fwd="99.90.16.79" dyno=web.1 connect=2ms service=10ms status=200 bytes=0
2013-10-19T17:25:15.537591+00:00 heroku[router]: at=info method=GET path=/ host=infinite-castle-2099.herokuapp.com fwd="99.90.16.79" dyno=web.1 connect=2ms service=14ms status=500 bytes=1266

votes_count显然,它说即使它在我的 schema.rb 中也找不到:

  create_table "links", force: true do |t|
    t.string   "description"
    t.string   "url"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "user_id"
    t.integer  "votes_count"
  end
4

1 回答 1

1

但是,当我访问该网址时,它显示“我们很抱歉,但出了点问题”。

在您的终端中运行

heroku logs --tail

要分析日志,您还可以刷新页面以查看最新日志。请尝试查找错误并将其粘贴到此处,以便我们为您提供更多帮助

编辑

尝试在 heroku 上运行你的迁移

heroku run rake db:migrate
于 2013-10-19T17:23:57.873 回答