繁体   English   中英

Rails App在本地运行,仅在Heroku部署后部分运行

[英]Rails App works locally, only partially runs after Heroku deployment

我有一个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

如果还有其他人遇到此问题并知道解决方法,我将非常感谢。

一个常见的误解是Heroku会在部署时为您运行迁移-但事实并非如此,即使在初次部署后,您也始终需要自己执行迁移。 heroku run rake db:migrate将使您摆脱当前的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM