2014-04-13 120 views
0

我一直在关注Daniel Kehoe的Learn Rails教程,并且所有工作都在开发中正常工作。学习Rails教程 - 部署到Heroku

当移动到Heroku的,我不得不应付一个thread_safe版本问题(更新至v0.3.3),但以结束:

Launching... done, v7 

然而,当我访问应用程序的网站 - http://learnrailstutorial.herokuapp.com - 我得到以下错误信息:

应用程序错误应用程序中发生错误,并且您的页面 无法提供服务。请稍后重试。如果您是 应用程序所有者,请检查日志以获取详细信息。

以下是我获取日志中:

$ heroku logs 
2014-04-13T18:35:12.897931+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each' 
2014-04-13T18:35:12.897930+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component' 
2014-04-13T18:35:12.897933+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:54:in `run_initializers' 
2014-04-13T18:35:12.897934+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/application.rb:215:in `initialize!' 
2014-04-13T18:35:12.897935+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/railtie/configurable.rb:30:in `method_missing' 
2014-04-13T18:35:12.897937+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 
2014-04-13T18:35:12.897938+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require' 
2014-04-13T18:35:12.897940+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `block in require' 
2014-04-13T18:35:12.897941+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:214:in `load_dependency' 
2014-04-13T18:35:12.897942+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require' 
2014-04-13T18:35:12.897946+00:00 app[web.1]: from /app/config.ru:3:in `block in <main>' 
2014-04-13T18:35:12.897948+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval' 
2014-04-13T18:35:12.897949+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize' 
2014-04-13T18:35:12.897950+00:00 app[web.1]: from /app/config.ru:in `new' 
2014-04-13T18:35:12.897952+00:00 app[web.1]: from /app/config.ru:in `<main>' 
2014-04-13T18:35:12.897955+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string' 
2014-04-13T18:35:12.897956+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file' 
2014-04-13T18:35:12.897953+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval' 
2014-04-13T18:35:12.897957+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config' 
2014-04-13T18:35:12.897958+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app' 
2014-04-13T18:35:12.897960+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands/server.rb:48:in `app' 
2014-04-13T18:35:12.897963+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app' 
2014-04-13T18:35:12.897965+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands/server.rb:75:in `start' 
2014-04-13T18:35:12.897966+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:76:in `block in <top (required)>' 
2014-04-13T18:35:12.897969+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `<top (required)>' 
2014-04-13T18:35:12.897967+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `tap' 
2014-04-13T18:35:12.897970+00:00 app[web.1]: from bin/rails:4:in `require' 
2014-04-13T18:35:12.897971+00:00 app[web.1]: from bin/rails:4:in `<main>' 
2014-04-13T18:35:12.916586+00:00 app[web.1]: => Rails 4.0.4 application starting in production on http://0.0.0.0:57365 
2014-04-13T18:35:12.916579+00:00 app[web.1]: => Booting Thin 
2014-04-13T18:35:12.916588+00:00 app[web.1]: => Run `rails server -h` for more startup options 
2014-04-13T18:35:12.916592+00:00 app[web.1]: Exiting 
2014-04-13T18:35:12.916590+00:00 app[web.1]: => Ctrl-C to shutdown server 
2014-04-13T18:35:14.054222+00:00 heroku[web.1]: State changed from starting to crashed 
2014-04-13T18:35:14.055058+00:00 heroku[web.1]: State changed from crashed to starting 
2014-04-13T18:35:14.042388+00:00 heroku[web.1]: Process exited with status 1 
2014-04-13T18:35:18.252062+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 40719 -e production` 
2014-04-13T18:35:21.022699+00:00 app[web.1]: from /app/config/environments/production.rb:82:in `block in <top (required)>' 
2014-04-13T18:35:21.022703+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/railtie/configurable.rb:24:in `configure' 
2014-04-13T18:35:21.022693+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/railtie/configurable.rb:30:in `method_missing': undefined method `learnrailstutorial' for #<LearnRails::Application:0x007fea7aac87f0> (NoMethodError) 
2014-04-13T18:35:21.022701+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/railtie/configurable.rb:24:in `class_eval' 
2014-04-13T18:35:21.022704+00:00 app[web.1]: from /app/config/environments/production.rb:1:in `<top (required)>' 
2014-04-13T18:35:21.022705+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require' 
2014-04-13T18:35:21.022707+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `block in require' 
2014-04-13T18:35:21.022708+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:214:in `load_dependency' 
2014-04-13T18:35:21.022709+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require' 
2014-04-13T18:35:21.022712+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:590:in `each' 
2014-04-13T18:35:21.022715+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:30:in `instance_exec' 
2014-04-13T18:35:21.022718+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each' 
2014-04-13T18:35:21.022716+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:30:in `run' 
2014-04-13T18:35:21.022724+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from' 
2014-04-13T18:35:21.022711+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>' 
2014-04-13T18:35:21.022726+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from' 
2014-04-13T18:35:21.022725+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from' 
2014-04-13T18:35:21.022713+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:590:in `block in <class:Engine>' 
2014-04-13T18:35:21.022717+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:55:in `block in run_initializers' 
2014-04-13T18:35:21.022729+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:44:in `tsort_each_child' 
2014-04-13T18:35:21.022730+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from' 
2014-04-13T18:35:21.022731+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component' 
2014-04-13T18:35:21.022722+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component' 
2014-04-13T18:35:21.022728+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:44:in `each' 
2014-04-13T18:35:21.022735+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each' 
2014-04-13T18:35:21.022734+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component' 
2014-04-13T18:35:21.022736+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:54:in `run_initializers' 
2014-04-13T18:35:21.022732+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each' 
2014-04-13T18:35:21.022739+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/railtie/configurable.rb:30:in `method_missing' 
2014-04-13T18:35:21.022740+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 
2014-04-13T18:35:21.022737+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/application.rb:215:in `initialize!' 
2014-04-13T18:35:21.022741+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require' 
2014-04-13T18:35:21.022743+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `block in require' 
2014-04-13T18:35:21.022744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:214:in `load_dependency' 
2014-04-13T18:35:21.022754+00:00 app[web.1]: from /app/config.ru:in `<main>' 
2014-04-13T18:35:21.022753+00:00 app[web.1]: from /app/config.ru:in `new' 
2014-04-13T18:35:21.022747+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require' 
2014-04-13T18:35:21.022749+00:00 app[web.1]: from /app/config.ru:3:in `block in <main>' 
2014-04-13T18:35:21.022750+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval' 
2014-04-13T18:35:21.022751+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize' 
2014-04-13T18:35:21.022756+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string' 
2014-04-13T18:35:21.022758+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file' 
2014-04-13T18:35:21.022759+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config' 
2014-04-13T18:35:21.022760+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app' 
2014-04-13T18:35:21.022755+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval' 
2014-04-13T18:35:21.022761+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands/server.rb:48:in `app' 
2014-04-13T18:35:21.022763+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app' 
2014-04-13T18:35:21.022764+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands/server.rb:75:in `start' 
2014-04-13T18:35:21.022769+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `<top (required)>' 
2014-04-13T18:35:21.022765+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:76:in `block in <top (required)>' 
2014-04-13T18:35:21.022768+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `tap' 
2014-04-13T18:35:21.022771+00:00 app[web.1]: from bin/rails:4:in `require' 
2014-04-13T18:35:21.022772+00:00 app[web.1]: from bin/rails:4:in `<main>' 
2014-04-13T18:35:21.042421+00:00 app[web.1]: => Booting Thin 
2014-04-13T18:35:21.042428+00:00 app[web.1]: => Rails 4.0.4 application starting in production on http://0.0.0.0:40719 
2014-04-13T18:35:21.042430+00:00 app[web.1]: => Run `rails server -h` for more startup options 
2014-04-13T18:35:21.042432+00:00 app[web.1]: => Ctrl-C to shutdown server 
2014-04-13T18:35:21.042433+00:00 app[web.1]: Exiting 
2014-04-13T18:35:22.361455+00:00 heroku[web.1]: Process exited with status 1 
2014-04-13T18:35:22.374267+00:00 heroku[web.1]: State changed from starting to crashed 
2014-04-13T18:36:06.763404+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=learnrailstutorial.herokuapp.com request_id=5c27afbd-ac1c-4525-b7eb-0cea294ec22b fwd="76.88.15.167" dyno= connect= service= status=503 bytes= 
2014-04-13T18:36:18.195687+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=learnrailstutorial.herokuapp.com request_id=9431bd21-bb32-4826-b5ea-10e578db1b22 fwd="76.88.15.167" dyno= connect= service= status=503 bytes= 
2014-04-13T18:37:19.982092+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=learnrailstutorial.herokuapp.com request_id=e7dcd7ad-3120-4157-b93e-63e89f589aeb fwd="76.88.15.167" dyno= connect= service= status=503 bytes= 
2014-04-13T18:39:17.034025+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=learnrailstutorial.herokuapp.com request_id=2f0adb38-6273-42e9-90a4-43f92fc6f7bd fwd="76.88.15.167" dyno= connect= service= status=503 bytes= 

的方法来解决这个任何想法?

非常感谢。

编辑:这里是我的production.rb文件

LearnRails::Application.configure do 
    # Settings specified here will take precedence over those in config/application.rb. 

    # Code is not reloaded between requests. 
    config.cache_classes = true 

    # Eager load code on boot. This eager loads most of Rails and 
    # your application in memory, allowing both thread web servers 
    # and those relying on copy on write to perform better. 
    # Rake tasks automatically ignore this option for performance. 
    config.eager_load = true 

    # Full error reports are disabled and caching is turned on. 
    config.consider_all_requests_local  = false 
    config.action_controller.perform_caching = true 

    # Enable Rack::Cache to put a simple HTTP cache in front of your application 
    # Add `rack-cache` to your Gemfile before enabling this. 
    # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. 
    # config.action_dispatch.rack_cache = true 

    # Disable Rails's static asset server (Apache or nginx will already do this). 
    config.serve_static_assets = false 

    # Compress JavaScripts and CSS. 
    config.assets.js_compressor = :uglifier 
    # config.assets.css_compressor = :sass 

    # Do not fallback to assets pipeline if a precompiled asset is missed. 
    config.assets.compile = false 

    # Generate digests for assets URLs. 
    config.assets.digest = true 

    # Version of your assets, change this if you want to expire all your assets. 
    config.assets.version = '1.0' 

    # Specifies the header that your server uses for sending files. 
    # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 
    # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 

    # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 
    # config.force_ssl = true 

    # Set to :debug to see everything in the log. 
    config.log_level = :info 

    # Prepend all log lines with the following tags. 
    # config.log_tags = [ :subdomain, :uuid ] 

    # Use a different logger for distributed setups. 
    # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 

    # Use a different cache store in production. 
    # config.cache_store = :mem_cache_store 

    # Enable serving of images, stylesheets, and JavaScripts from an asset server. 
    # config.action_controller.asset_host = "http://assets.example.com" 

    # Precompile additional assets. 
    # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 
    # config.assets.precompile += %w(search.js) 

    # Ignore bad email addresses and do not raise email delivery errors. 
    # Set this to true and configure the email server for immediate delivery to raise delivery errors. 
    # config.action_mailer.raise_delivery_errors = false 

    # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 
    # the I18n.default_locale when a translation can not be found). 
    config.i18n.fallbacks = true 

    # Send deprecation notices to registered listeners. 
    config.active_support.deprecation = :notify 

    # Disable automatic flushing of the log to improve performance. 
    # config.autoflush_log = false 

    # Use default logging formatter so that PID and timestamp are not suppressed. 
    config.log_formatter = ::Logger::Formatter.new 

    # email enabled in production 
    config.action_mailer.default_url_options = { :host => learnrailstutorial.herokuapp.com } 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.perform_deliveries = true 
    config.action_mailer.raise_delivery_errors = false 
    config.action_mailer.default :charset => "utf-8" 
    config.action_mailer.smtp_settings = { 
    address: "smtp.gmail.com", 
    port: 587, 
    domain: learnrailstutorial.herokuapp.com, 
    authentication: "plain", 
    enable_starttls_auto: true, 
    user_name: ENV["GMAIL_USERNAME"], 
    password: ENV["GMAIL_PASSWORD"] 
    } 
end 

,这里是我的路线:

LearnRails::Application.routes.draw do 
    resources :contacts, only: [:new, :create] 
    resources :visitors, only: [:new, :create] 
    root to: 'visitors#new' 
end 
+0

你可以分享你'production.rb'文件。 –

+0

你有在routes.rb中定义的根路由吗? – janosrusiczki

+0

@KirtiThorat:是的,我只是把它添加到问题中。 –

回答

1

production.rb

变化

config.action_mailer.default_url_options = { :host => learnrailstutorial.herokuapp.com } 

为了

config.action_mailer.default_url_options = { :host => "learnrailstutorial.herokuapp.com" } 

同样更新config.action_mailer.smtp_settingsdomain期权价值。

由于主机名不在引号,Rails将其解释为方法名称并寻找它的定义。如果您发现错误日志,你会看到

method_missing': undefined method 'learnrailstutorial

+0

这个改变实际上解决了这个问题。 但是我也必须将第二次出现的domaine名称更改为引号,在同一个production.rb文件中。 非常感谢。 –

+0

很高兴帮助。 :)请在有机会时接受答案。 –