在localhost中,我的项目运行得很好,但是每次我部署到heroku时,我都会收到错误.....我还运行了Heroku run rake db:migrate。知道这是怎么回事吗?
2015-11-01T23:27:52.203020+00:00 app[web.1]: bin/rails:8:in `require'
2015-11-01T23:27:52.203020+00:00 app[web.1]: bin/rails:8:in `<main>'
2015-11-01T23:27:52.203072+00:00 app[web.1]: [2015-11-01 23:27:52] INFO going to shutdown ...
2015-11-01T23:27:52.203127+00:00 app[web.1]: Exiting
2015-11-01T23:27:52.532296+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 41390 -e production`
2015-11-01T23:27:52.897623+00:00 heroku[web.1]: Process exited with status 143
2015-11-01T23:27:58.070739+00:00 app[web.1]: [2015-11-01 23:27:58] INFO WEBrick 1.3.1
2015-11-01T23:27:58.070767+00:00 app[web.1]: [2015-11-01 23:27:58] INFO ruby 2.2.1 (2015-02-26) [x86_64-linux]
2015-11-01T23:27:58.071119+00:00 app[web.1]: [2015-11-01 23:27:58] INFO WEBrick::HTTPServer#start: pid=3 port=41390
2015-11-01T23:27:58.474379+00:00 heroku[web.1]: State changed from starting to up
2015-11-01T23:27:59.642521+00:00 app[web.1]: => Booting WEBrick
2015-11-01T23:27:59.642524+00:00 app[web.1]: => Rails 4.2.4 application starting in production on http://0.0.0.0:41390
2015-11-01T23:27:59.642526+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-11-01T23:27:59.642527+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-11-01T23:27:59.642527+00:00 app[web.1]: Started GET "/" for 186.7.194.9 at 2015-11-01 23:27:59 +0000
2015-11-01T23:27:59.766836+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-11-01T23:27:59.799012+00:00 app[web.1]: Listing Load (2.1ms) SELECT "listings".* FROM "listings"
2015-11-01T23:28:00.392668+00:00 heroku[router]: at=info method=GET path="/" host=first-2015.herokuapp.com request_id=926437db-f38c-4e20-bd41-214c5a3c23e4 fwd="186.7.194.9" dyno=web.1 connect=1ms service=776ms status=500 bytes=1754
2015-11-01T23:28:00.357900+00:00 app[web.1]: Completed 500 Internal Server Error in 591ms (ActiveRecord: 43.1ms)
2015-11-01T23:28:00.357305+00:00 app[web.1]: Rendered listings/index.html.erb within layouts/application (561.8ms)
2015-11-01T23:28:00.379967+00:00 app[web.1]:
2015-11-01T23:28:00.379972+00:00 app[web.1]: ActionView::Template::Error (Path '/original/1_maxresdefault.jpg' not found):
2015-11-01T23:28:00.379974+00:00 app[web.1]: 3: <% @listings.each do |listing| %>
2015-11-01T23:28:00.379975+00:00 app[web.1]: 4: <div class="col-md-3">
2015-11-01T23:28:00.379975+00:00 app[web.1]: 5: <div class="thumbnail">
2015-11-01T23:28:00.379976+00:00 app[web.1]: 6: <%= image_tag listing.image.url %>
2015-11-01T23:28:00.379976+00:00 app[web.1]: 7: <div class="caption">
2015-11-01T23:28:00.379977+00:00 app[web.1]: 8: <h3><%= listing.name %></h3>
2015-11-01T23:28:00.379978+00:00 app[web.1]: 9: <p><%= number_to_currency(listing.price)%></p>
2015-11-01T23:28:00.379979+00:00 app[web.1]: app/views/listings/index.html.erb:6:in `block in _app_views_listings_index_html_erb___3544290808032810079_70137168564260'
2015-11-01T23:28:00.379980+00:00 app[web.1]: app/views/listings/index.html.erb:3:in `_app_views_listings_index_html_erb___3544290808032810079_70137168564260'
2015-11-01T23:28:00.379980+00:00 app[web.1]:
2015-11-01T23:28:00.379981+00:00 app[web.1]:
2015-11-01T23:28:35.183269+00:00 heroku[web.1]: State changed from up to starting
2015-11-01T23:28:37.475572+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 45138 -e production`
2015-11-01T23:28:39.679694+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-11-01T23:28:41.150522+00:00 app[web.1]: [2015-11-01 23:28:41] FATAL SignalException: SIGTERM
2015-11-01T23:28:41.150526+00:00 app[web.1]: /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:174:in `select'
2015-11-01T23:28:41.150528+00:00 app[web.1]: /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:174:in `block in start'
2015-11-01T23:28:41.150529+00:00 app[web.1]: /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:32:in `start'
2015-11-01T23:28:41.150530+00:00 app[web.1]: /app/vendor/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:162:in `start'
2015-11-01T23:28:41.150530+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:34:in `run'
2015-11-01T23:28:41.150531+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
2015-11-01T23:28:41.150532+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'
2015-11-01T23:28:41.150533+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'
2015-11-01T23:28:41.150534+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-11-01T23:28:41.150535+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-11-01T23:28:41.150535+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-11-01T23:28:41.150536+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
2015-11-01T23:28:41.150537+00:00 app[web.1]: bin/rails:8:in `require'
2015-11-01T23:28:41.150538+00:00 app[web.1]: bin/rails:8:in `<main>'
2015-11-01T23:28:41.150616+00:00 app[web.1]: [2015-11-01 23:28:41] INFO going to shutdown ...
2015-11-01T23:28:41.150667+00:00 app[web.1]: [2015-11-01 23:28:41] INFO WEBrick::HTTPServer#start done.
2015-11-01T23:28:41.150693+00:00 app[web.1]: Exiting
2015-11-01T23:28:42.127027+00:00 heroku[web.1]: Process exited with status 143
2015-11-01T23:28:42.240828+00:00 app[web.1]: [2015-11-01 23:28:42] INFO WEBrick 1.3.1
2015-11-01T23:28:42.240888+00:00 app[web.1]: [2015-11-01 23:28:42] INFO ruby 2.2.1 (2015-02-26) [x86_64-linux]
2015-11-01T23:28:42.241276+00:00 app[web.1]: [2015-11-01 23:28:42] INFO WEBrick::HTTPServer#start: pid=3 port=45138
2015-11-01T23:28:42.749478+00:00 heroku[web.1]: State changed from starting to up
2015-11-01T23:28:43.792876+00:00 app[web.1]: => Booting WEBrick
2015-11-01T23:28:43.792882+00:00 app[web.1]: => Rails 4.2.4 application starting in production on http://0.0.0.0:45138
2015-11-01T23:28:43.792883+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-11-01T23:28:43.792884+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-11-01T23:28:43.792884+00:00 app[web.1]: Started GET "/" for 186.7.194.9 at 2015-11-01 23:28:43 +0000
2015-11-01T23:28:43.852744+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-11-01T23:28:43.871140+00:00 app[web.1]: Listing Load (1.8ms) SELECT "listings".* FROM "listings"
2015-11-01T23:28:44.290320+00:00 heroku[router]: at=info method=GET path="/" host=first-2015.herokuapp.com request_id=801454af-a367-44c0-813d-11682425132c fwd="186.7.194.9" dyno=web.1 connect=1ms service=503ms status=500 bytes=1754
2015-11-01T23:28:44.289069+00:00 app[web.1]: Rendered listings/index.html.erb within layouts/application (421.4ms)
2015-11-01T23:28:44.290295+00:00 app[web.1]:
2015-11-01T23:28:44.289266+00:00 app[web.1]: Completed 500 Internal Server Error in 436ms (ActiveRecord: 9.3ms)
2015-11-01T23:28:44.290297+00:00 app[web.1]: ActionView::Template::Error (Path '/original/1_maxresdefault.jpg' not found):
2015-11-01T23:28:44.290299+00:00 app[web.1]: 4: <div class="col-md-3">
2015-11-01T23:28:44.290299+00:00 app[web.1]: 3: <% @listings.each do |listing| %>
2015-11-01T23:28:44.290301+00:00 app[web.1]: 6: <%= image_tag listing.image.url %>
2015-11-01T23:28:44.290300+00:00 app[web.1]: 5: <div class="thumbnail">
2015-11-01T23:28:44.290302+00:00 app[web.1]: 8: <h3><%= listing.name %></h3>
2015-11-01T23:28:44.290303+00:00 app[web.1]: 9: <p><%= number_to_currency(listing.price)%></p>
2015-11-01T23:28:44.290302+00:00 app[web.1]: 7: <div class="caption">
2015-11-01T23:28:44.290305+00:00 app[web.1]: app/views/listings/index.html.erb:3:in `_app_views_listings_index_html_erb__2061699741869559202_69894874271620'
2015-11-01T23:28:44.290304+00:00 app[web.1]: app/views/listings/index.html.erb:6:in `block in _app_views_listings_index_html_erb__2061699741869559202_69894874271620'
2015-11-01T23:28:44.290306+00:00 app[web.1]:
2015-11-01T23:28:44.290306+00:00 app[web.1]:
2015-11-01T23:35:20.887734+00:00 app[web.1]: Started GET "/" for 186.7.194.9 at 2015-11-01 23:35:20 +0000
2015-11-01T23:35:20.894377+00:00 app[web.1]: Listing Load (1.7ms) SELECT "listings".* FROM "listings"
2015-11-01T23:35:20.890439+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-11-01T23:35:21.264843+00:00 heroku[router]: at=info method=GET path="/" host=first-2015.herokuapp.com request_id=7c3a22ea-957b-49f6-83d5-6d639dae83f2 fwd="186.7.194.9" dyno=web.1 connect=0ms service=380ms status=500 bytes=1754
2015-11-01T23:35:21.258765+00:00 app[web.1]: Rendered listings/index.html.erb within layouts/application (366.5ms)
2015-11-01T23:35:21.263640+00:00 app[web.1]:
2015-11-01T23:35:21.263643+00:00 app[web.1]: ActionView::Template::Error (Path '/original/1_maxresdefault.jpg' not found):
2015-11-01T23:35:21.263644+00:00 app[web.1]: 3: <% @listings.each do |listing| %>
2015-11-01T23:35:21.263645+00:00 app[web.1]: 4: <div class="col-md-3">
2015-11-01T23:35:21.263646+00:00 app[web.1]: 5: <div class="thumbnail">
2015-11-01T23:35:21.263646+00:00 app[web.1]: 6: <%= image_tag listing.image.url %>
2015-11-01T23:35:21.263647+00:00 app[web.1]: 7: <div class="caption">
2015-11-01T23:35:21.263648+00:00 app[web.1]: 8: <h3><%= listing.name %></h3>
2015-11-01T23:35:21.263649+00:00 app[web.1]: 9: <p><%= number_to_currency(listing.price)%></p>
2015-11-01T23:35:21.263651+00:00 app[web.1]: app/views/listings/index.html.erb:3:in `_app_views_listings_index_html_erb__2061699741869559202_69894874271620'
2015-11-01T23:35:21.263650+00:00 app[web.1]: app/views/listings/index.html.erb:6:in `block in _app_views_listings_index_html_erb__2061699741869559202_69894874271620'
2015-11-01T23:35:21.263651+00:00 app[web.1]:
2015-11-01T23:35:21.263652+00:00 app[web.1]:
2015-11-01T23:35:21.261958+00:00 app[web.1]: Completed 500 Internal Server Error in 371ms (ActiveRecord: 1.7ms)
2条答案
按热度按时间2exbekwf1#
这是您的错误:
问题似乎是
listing.image.url
的路径无法识别。我不知道为什么Rails将此视为致命错误(通常,它只会显示带有“未找到”图像的HTML
img
),但在这种情况下,它会导致整个Rails应用程序失败。解决方法(使其正常工作)是从
app/views/listings/index.html.erb
文件中删除<%= image_tag listing.image.url %>
。这不是一个修复程序,但应该可以解决当前的问题。
1.确保回形针文件完好无损
1.确保数据库具有正确的引用
问题似乎是
/original/1_maxresdefault.jpg
不存在。YouTube使用了这个图片名称,所以我怀疑你要么是在删除YouTube的封面图片,要么是在模仿YouTube的视频处理结构。
无论采用哪种方式,应用程序中的文件夹结构都应如下所示:
public/system/[model]/[attachment]/[other_options]/[sizes]/[file].[extension]
在我看来,您的路径没有被正确调用,或者您没有正确的文件名。您可能手动填充了文件名或其他内容。
我会亲自删除整个
/public/system
文件夹(它是Paperclips的),删除所有引用附件在您的数据库和通过我所有的listings
上传新的图像。然后我会确保
public/system
存在于git push中(你可以通过检查它不在.gitignore
中来确保这一点),然后再次推送到Heroku。还要确保Heroku的数据库结构模仿您的开发环境--可能会出现 production 数据库中引用的映像不存在的情况。
wixjitnu2#
您应该下载rails_12factor gem。
https://github.com/heroku/rails_12factor
这将帮助你更好地理解你的heroku日志。