简体   繁体   中英

Rails App works locally, only partially runs after Heroku deployment

I have a rails app that worked fine locally, but once I deployed to heroku, one view, the one that has the meat of the app in it, just says "We're sorry, but something went wrong."

According to the Heroku logs, it seems like it isn't recognizing "places" which is the name of the model and controller.

My gemfile has PG for production and SQLite3 for development. I can't seem to find how to fix it. Here are the logs:

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

If anyone else has had this problem and knows a good fix for it, I would be very grateful.

It's a common misconception that Heroku runs migrations for you on deploy - they do not, you always need to perform migrations yourself even after initial deployment. heroku run rake db:migrate will get you out of your current problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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