我有一个在本地运行良好的rails应用程序,但是一旦我部署到heroku,一个视图,其中有应用程序的内容,只是说“我们很抱歉,但出了点问题。”< / p>
根据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
如果有其他人遇到过这个问题并且知道一个很好的解决办法,我将非常感激。
答案 0 :(得分:3)
Heroku在部署时为您运行迁移是一种常见的误解 - 他们不这样做,即使在初始部署之后,您也始终需要自己执行迁移。 heroku run rake db:migrate
会让您摆脱当前的问题。