我只是在Heroku的制作中遇到“出错了”500错误,并且仅针对我的一个几乎完全没有动态内容的页面。
在日志中,它显示以下内容:
ActionView::MissingTemplate (Missing template pages/contact, application/contact with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee, :haml]}. Searched in:
2013-03-28T03:42:28+00:00 app[web.1]: * "/app/app/views"
2013-03-28T03:42:28+00:00 app[web.1]:
但是,模板肯定是在那个位置。 Heroku运行rake路线显示正确的路线。我按照其他论坛的建议,将uglifier,coffeescript和haml-rails从我的gemfile的资产组中移出。 Gemfile现在看起来像这样:
source 'http://rubygems.org'
gem 'mail'
gem 'rails', '3.2.13'
gem 'pg'
gem 'twitter'
gem 'jquery-rails'
gem 'rake', '10.0.4'
gem 'sass', "~> 3.2.7"
gem 'haml-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'therubyracer'
gem 'sass-rails'
group :development do
gem 'rspec-rails'
gem 'annotate'
gem 'faker', '0.3.1'
end
group :test do
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'rspec-rails'
gem 'webrat', '0.7.1'
gem 'spork', '0.9.0.rc8'
gem 'factory_girl_rails', '1.0'
gem 'autotest', '4.4.6'
gem 'autotest-rails-pure', '4.1.2'
gem 'autotest-fsevent', '0.2.5'
gem 'autotest-growl', '0.2.9'
gem 'ZenTest' , '4.8.3'
end
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
我没有在日志或其他Stack Overflow问题中看到任何有用的内容。那里有新鲜的眼睛看到我不知道的东西?
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:34:in `determine_template'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:36:in `render_template'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/streaming.rb:225:in `_render_template'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:110:in `_render_template'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:17:in `render'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
2013-03-28T03:42:28+00:00 app[web.1]:
2013-03-28T03:42:28+00:00 app[web.1]: ActionView::MissingTemplate (Missing template pages/contact, application/contact with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee, :haml]}. Searched in:
2013-03-28T03:42:28+00:00 app[web.1]: * "/app/app/views"
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/renderer/abstract_renderer.rb:3:in `find_template'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:103:in `render_to_body'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/lookup_context.rb:109:in `find'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:10:in `render'
2013-03-28T03:42:28+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/benchmark.rb:310:in `realtime'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:39:in `render'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:88:in `render'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_view/path_set.rb:58:in `find'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:16:in `render'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actio
npack-3.2.13/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:in `process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/core_ext/benchmark.rb:5:in `ms'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:414:in `_run__115463730327225923__process_action__2482471898787976109__callbacks'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
2013-03-28T03:42:27+00:00 heroku[router]: at=info method=GET path=/contact host=polar-plains-8193.herokuapp.com fwd="98.164.80.126" dyno=web.1 connect=3ms service=15ms status=500 bytes=643
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__402893550312028338__call__2852970105878458306__callbacks'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:
36:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
2013-03-28T03:42:28+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
2013-03-28T03:42:28+00:00 app[web.1]:
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
2013-03-28T03:42:28+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
2013-03-28T03:42:28+00:00 app[web.1]:
2013-03-28T03:42:28+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/log_tailer.rb:17:in `call'
答案 0 :(得分:2)
要确认contact.html.erb是否已将其发送至Heroku,请尝试运行以下命令:
heroku run bash
cat app/views/pages/contact.html.erb
答案 1 :(得分:0)
在放弃之前,我决定采用一种非常奇怪的冰雹玛丽预感来解决问题。
我将有问题的文件“contact.html.erb”,“contact.css.erb”复制并粘贴到名为“contacto.html.erb”等的新镜像文件中,代替“联系人”。
将路线更改为:match'/ contact'=> 'pages#contacto'并推送到heroku。错误消失了。更令人惊讶的是,在我删除原件并用“联系人”代替contacto重命名那些相同的文件后,它仍然有用。
我真的不明白这项工作背后的伏都教是什么。我本来只是尝试路由解决方法。我甚至先删除了那些“联系”文件中的所有内容并将它们推送到heroku,替换了所有内容并再次推送它们,没有任何改动。