0

我有一个在本地运行良好的 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

如果其他人遇到过这个问题并且知道一个很好的解决方法,我将非常感激。

4

1 回答 1

3

Heroku 在部署时会为您运行迁移是一个常见的误解——它们不会,即使在初始部署之后,您也总是需要自己执行迁移。heroku run rake db:migrate会让你摆脱目前的问题。

于 2013-04-07T06:22:16.987 回答