2013-04-06 52 views
0

我有一個在當地運行良好的Rails應用程序,但是一旦我部署到heroku,一個視圖,其中有應用程序的肉,只是說「我們對不起,但出了問題。「Rails應用程序在本地運行,部分在Heroku部署後部分運行

根據Heroku日誌,它似乎不識別「地點」,這是模型和控制器的名稱。

我的gemfile有生產用的PG和用於開發的SQLite3。我似乎無法找到如何解決它。下面是日誌:

2013-04-06T14:42:51+00:00 app[web.1]: Started GET "/help" for 72.229.188.61 at 2013-04-06 14:42:51  +0000 
2013-04-06T14:42:51+00:00 app[web.1]: Processing by PlacesController#index as HTML 
2013-04-06T14:42:51+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "places" does not exist 
2013-04-06T14:42:51+00:00 app[web.1]:      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod 
2013-04-06T14:42:51+00:00 app[web.1]: Completed 500 Internal Server Error in 215ms 
2013-04-06T14:42:51+00:00 app[web.1]: LINE 5:    WHERE a.attrelid = '"places"'::regclass 
2013-04-06T14:42:51+00:00 app[web.1]: :    SELECT a.attname, format_type(a.atttypid, a.atttypmod), 
2013-04-06T14:42:51+00:00 app[web.1]:    WHERE a.attrelid = '"places"'::regclass 
2013-04-06T14:42:51+00:00 app[web.1]: 
2013-04-06T14:42:51+00:00 app[web.1]: 
2013-04-06T14:42:51+00:00 app[web.1]: Started GET "/help" for 72.229.188.61 at 2013-04-06 14:42:51 +0000 
2013-04-06T14:42:51+00:00 app[web.1]:    FROM pg_attribute a LEFT JOIN pg_attrdef d 
2013-04-06T14:42:51+00:00 app[web.1]:     ON a.attrelid = d.adrelid AND a.attnum = d.adnum 
2013-04-06T14:42:51+00:00 app[web.1]: 
2013-04-06T14:42:51+00:00 app[web.1]:    AND a.attnum > 0 AND NOT a.attisdropped 
2013-04-06T14:42:51+00:00 app[web.1]:          ^
2013-04-06T14:42:51+00:00 app[web.1]:): 
2013-04-06T14:42:51+00:00 app[web.1]: 
2013-04-06T14:42:51+00:00 app[web.1]: Processing by PlacesController#index as HTML 
2013-04-06T14:42:51+00:00 app[web.1]:): 
2013-04-06T14:42:51+00:00 app[web.1]:    ORDER BY a.attnum 
2013-04-06T14:42:51+00:00 app[web.1]: app/controllers/places_controller.rb:3:in `index' 
2013-04-06T14:42:51+00:00 app[web.1]: app/controllers/places_controller.rb:3:in `index' 
2013-04-06T14:42:51+00:00 app[web.1]: Completed 500 Internal Server Error in 6ms 
2013-04-06T14:42:51+00:00 app[web.1]: 
2013-04-06T14:42:51+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "places" does not exist 
2013-04-06T14:42:51+00:00 app[web.1]: LINE 5:    WHERE a.attrelid = '"places"'::regclass 
2013-04-06T14:42:51+00:00 app[web.1]:    WHERE a.attrelid = '"places"'::regclass 
2013-04-06T14:42:51+00:00 app[web.1]:    ORDER BY a.attnum 
2013-04-06T14:42:51+00:00 app[web.1]:    AND a.attnum > 0 AND NOT a.attisdropped 
2013-04-06T14:42:51+00:00 app[web.1]:          ^
2013-04-06T14:42:51+00:00 app[web.1]: :    SELECT a.attname, format_type(a.atttypid, a.atttypmod), 
2013-04-06T14:42:51+00:00 app[web.1]:      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod 
2013-04-06T14:42:51+00:00 app[web.1]:    FROM pg_attribute a LEFT JOIN pg_attrdef d 
2013-04-06T14:42:51+00:00 app[web.1]:     ON a.attrelid = d.adrelid AND a.attnum = d.adnum 
2013-04-06T14:42:51+00:00 app[web.1]: 
2013-04-06T14:42:51+00:00 heroku[router]: at=info method=GET path=/help host=taskeyo.herokuapp.com fwd="72.229.188.61" dyno=web.1 connect=0ms service=291ms status=500 bytes=643 
2013-04-06T14:42:51+00:00 heroku[router]: at=info method=GET path=/help host=taskeyo.herokuapp.com fwd="72.229.188.61" dyno=web.1 connect=1ms service=301ms status=500 bytes=643 
2013-04-06T15:52:36+00:00 heroku[web.1]: Stopping all processes with SIGTERM 
2013-04-06T15:52:37+00:00 app[web.1]: [2013-04-06 15:52:37] ERROR SignalException: SIGTERM 
2013-04-06T15:52:37+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select' 
2013-04-06T15:52:45+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL 
2013-04-06T15:52:45+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM 
2013-04-06T15:52:47+00:00 heroku[web.1]: Process exited with status 137 
2013-04-06T15:52:47+00:00 heroku[web.1]: State changed from up to down 
2013-04-06T15:52:32+00:00 heroku[web.1]: Idling 

如果任何人有過這個問題,並知道它的好修正,我將非常感激。

+2

你在Heroku上設置了數據庫嗎?嘗試運行'heroku rake db:create'和'heroku rake db:migrate'? – Intelekshual 2013-04-07 00:39:24

回答

3

Heroku通常會誤解爲您部署部署的遷移 - 他們不需要,即使在初始部署後,您也需要自己執行遷移。 heroku run rake db:migrate會讓你擺脫當前的問題。

+0

謝謝約翰!現在全部設置。我現在每次部署後都會遷移。謝謝! – Vincent 2013-04-07 14:04:03

+0

只有當你有新的遷移時:)但是運行它們並沒有什麼壞處,因爲如果你沒有,它們將不會做任何事情。親自爲開發,我調整了ruby heroku buildpack爲我部署遷移https://github.com/johnbeynon/heroku-buildpack-ruby – 2013-04-07 20:17:06

+0

我會檢查出來。謝謝約翰。 – Vincent 2013-04-08 22:53:18

相關問題