ruby-on-rails - Rails Devise 推送到 Heroku:Errno::ECONNREFUSED(连接被拒绝 - connect(2)):

标签 ruby-on-rails ruby heroku devise

我正在做我的学校作业。在这个阶段,我已经实现了 Devise 进行身份验证。整个项目对我来说在本地运行良好。当我推到 Heroku 时,这是另一个故事了。这是该应用程序的链接。 http://jonathanmusso-bloccit.herokuapp.com/

我第一次尝试在 Heroku 上运行该应用程序时收到此错误:

ActionView::Template::Error (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):

所以我将最后 4 行添加到下面的 production.rb 中。

配置/环境/生产.rb

Rails.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 threaded 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 serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?

# 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

# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true

# `config.assets.precompile` and `config.assets.version` have moved to   config/initializers/assets.rb

# 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

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug

# 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'

# 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 = true

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

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

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

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = { host: 'jonathanmusso-bloccit.herokuapp.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
end

目前我从 Heroku 日志中收到此错误:

Errno::ECONNREFUSED (Connection refused - connect(2)):

这是我的开发.rb

config/environment/development.rb

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

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

# Do not eager load code on boot.
config.eager_load = false

# Show full error reports and disable caching.
config.consider_all_requests_local       = true
config.action_controller.perform_caching = false

# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true

# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true

# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
end

这是 Heroku 日志

2015-04-27T17:49:41.761916+00:00 app[web.1]: Devise::Mailer#confirmation_instructions: processed outbound mail in 6.5ms
2015-04-27T17:49:41.770595+00:00 app[web.1]: 
2015-04-27T17:49:41.770602+00:00 app[web.1]: Sent mail to <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a7cdc8c9c6d3cfc6c9cad2d4d4c8e7c0cac6cecb89c4c8ca" rel="noreferrer noopener nofollow">[email protected]</a> (8.4ms)
2015-04-27T17:49:41.770611+00:00 app[web.1]: Date: Mon, 27 Apr 2015 17:49:41 +0000
2015-04-27T17:49:41.770613+00:00 app[web.1]: From: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ea9a868f8b998fc789828b848d8fc7878fc78b9ec78985848c838dc78384839e838b8683908f9899c78e8f9c83998faa8f928b879a868fc4898587" rel="noreferrer noopener nofollow">[email protected]</a>
2015-04-27T17:49:41.770614+00:00 app[web.1]: Reply-To: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="06766a636775632b656e676861632b6b632b67722b656968606f612b6f686f726f676a6f7c6374752b6263706f756346637e676b766a632865696b" rel="noreferrer noopener nofollow">[email protected]</a>
2015-04-27T17:49:41.770616+00:00 app[web.1]: To: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7bdb8b9b6a3bfb6b9baa2a4a4b897b0bab6bebbf9b4b8ba" rel="noreferrer noopener nofollow">[email protected]</a>
2015-04-27T17:49:41.770618+00:00 app[web.1]: Message-ID: <553e76b5ba6d8_33fcab6012654510e5@b9046e1c-9d61-4a67-ae9e-5a313eda122a.mail>
2015-04-27T17:49:41.770619+00:00 app[web.1]: Subject: Confirmation instructions
2015-04-27T17:49:41.770621+00:00 app[web.1]: Mime-Version: 1.0
2015-04-27T17:49:41.770622+00:00 app[web.1]: Content-Type: text/html;
2015-04-27T17:49:41.770624+00:00 app[web.1]:  charset=UTF-8
2015-04-27T17:49:41.770625+00:00 app[web.1]: Content-Transfer-Encoding: 7bit
2015-04-27T17:49:41.770627+00:00 app[web.1]: 
2015-04-27T17:49:41.770628+00:00 app[web.1]: <p>Welcome <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f09a9f9e918498919e9d8583839fb0979d91999cde939f9d" rel="noreferrer noopener nofollow">[email protected]</a>!</p>
2015-04-27T17:49:41.770629+00:00 app[web.1]: 
2015-04-27T17:49:41.770631+00:00 app[web.1]: <p>You can confirm your account email through the link below:</p>
2015-04-27T17:49:41.770633+00:00 app[web.1]: 
2015-04-27T17:49:41.770634+00:00 app[web.1]: <p><a href="http://jonathanmusso-bloccit.herokuapp.com/users/confirmation?confirmation_token=DJYDV5wM1zNUzkkt1cNx">Confirm my account</a></p>
2015-04-27T17:49:41.770636+00:00 app[web.1]: 
2015-04-27T17:49:41.774174+00:00 app[web.1]:    (3.3ms)  ROLLBACK
2015-04-27T17:49:41.779181+00:00 app[web.1]: 
2015-04-27T17:49:41.779184+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - connect(2)):
2015-04-27T17:49:41.779186+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:541:in `initialize'
2015-04-27T17:49:41.779187+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:541:in `open'
2015-04-27T17:49:41.779189+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:541:in `tcp_socket'
2015-04-27T17:49:41.779190+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:551:in `block in do_start'
2015-04-27T17:49:41.779192+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
2015-04-27T17:49:41.779193+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:550:in `do_start'
2015-04-27T17:49:41.779195+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:520:in `start'
2015-04-27T17:49:41.779197+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
2015-04-27T17:49:41.779198+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:2141:in `do_delivery'
2015-04-27T17:49:41.779200+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:236:in `block in deliver'
2015-04-27T17:49:41.779201+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.1/lib/action_mailer/base.rb:543:in `block in deliver_mail'
2015-04-27T17:49:41.779203+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
2015-04-27T17:49:41.779205+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2015-04-27T17:49:41.779206+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
2015-04-27T17:49:41.779208+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.1/lib/action_mailer/base.rb:541:in `deliver_mail'
2015-04-27T17:49:41.779209+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:236:in `deliver'
2015-04-27T17:49:41.779211+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.1/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
2015-04-27T17:49:41.779212+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/authenticatable.rb:176:in `send_devise_notification'
2015-04-27T17:49:41.779214+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/confirmable.rb:102:in `send_confirmation_instructions'
2015-04-27T17:49:41.779231+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/confirmable.rb:158:in `send_on_create_confirmation_instructions'
2015-04-27T17:49:41.779233+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:432:in `block in make_lambda'
2015-04-27T17:49:41.779234+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:228:in `call'
2015-04-27T17:49:41.779236+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:228:in `block in halting_and_conditional'
2015-04-27T17:49:41.779237+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `call'
2015-04-27T17:49:41.779238+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `block in call'
2015-04-27T17:49:41.779240+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `each'
2015-04-27T17:49:41.779241+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `call'
2015-04-27T17:49:41.779243+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
2015-04-27T17:49:41.779246+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_create_callbacks'
2015-04-27T17:49:41.779247+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/callbacks.rb:306:in `_create_record'
2015-04-27T17:49:41.779257+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/timestamp.rb:57:in `_create_record'
2015-04-27T17:49:41.779258+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/persistence.rb:502:in `create_or_update'
2015-04-27T17:49:41.779260+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/callbacks.rb:302:in `block in create_or_update'
2015-04-27T17:49:41.779261+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `call'
2015-04-27T17:49:41.779263+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `_run_callbacks'
2015-04-27T17:49:41.779264+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_save_callbacks'
2015-04-27T17:49:41.779265+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/callbacks.rb:302:in `create_or_update'
2015-04-27T17:49:41.779267+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/persistence.rb:120:in `save'
2015-04-27T17:49:41.779268+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/validations.rb:37:in `save'
2015-04-27T17:49:41.779269+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/attribute_methods/dirty.rb:21:in `save'
2015-04-27T17:49:41.779335+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:286:in `block (2 levels) in save'
2015-04-27T17:49:41.779338+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:347:in `block in with_transaction_returning_status'
2015-04-27T17:49:41.779339+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
2015-04-27T17:49:41.779341+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
2015-04-27T17:49:41.779343+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
2015-04-27T17:49:41.779344+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:220:in `transaction'
2015-04-27T17:49:41.779346+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:344:in `with_transaction_returning_status'
2015-04-27T17:49:41.779347+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:286:in `block in save'
2015-04-27T17:49:41.779348+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:301:in `rollback_active_record_state!'
2015-04-27T17:49:41.779350+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:285:in `save'
2015-04-27T17:49:41.779351+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/app/controllers/devise/registrations_controller.rb:19:in `create'
2015-04-27T17:49:41.779353+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
2015-04-27T17:49:41.779354+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:198:in `process_action'
2015-04-27T17:49:41.779356+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
2015-04-27T17:49:41.779358+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
2015-04-27T17:49:41.779359+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
2015-04-27T17:49:41.779360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
2015-04-27T17:49:41.779362+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
2015-04-27T17:49:41.779363+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
2015-04-27T17:49:41.779364+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
2015-04-27T17:49:41.779365+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
2015-04-27T17:49:41.779367+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
2015-04-27T17:49:41.779368+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
2015-04-27T17:49:41.779370+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
2015-04-27T17:49:41.779371+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rescue.rb:29:in `process_action'
2015-04-27T17:49:41.779372+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
2015-04-27T17:49:41.779374+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
2015-04-27T17:49:41.779376+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2015-04-27T17:49:41.779377+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
2015-04-27T17:49:41.779378+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
2015-04-27T17:49:41.779380+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
2015-04-27T17:49:41.779388+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
2015-04-27T17:49:41.779390+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:137:in `process'
2015-04-27T17:49:41.779392+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:30:in `process'
2015-04-27T17:49:41.779393+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:196:in `dispatch'
2015-04-27T17:49:41.779397+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
2015-04-27T17:49:41.779426+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:237:in `block in action'
2015-04-27T17:49:41.779428+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:74:in `call'
2015-04-27T17:49:41.779429+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
2015-04-27T17:49:41.779430+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:43:in `serve'
2015-04-27T17:49:41.779432+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:49:in `serve'
2015-04-27T17:49:41.779433+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:43:in `block in serve'
2015-04-27T17:49:41.779435+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `each'
2015-04-27T17:49:41.779436+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `serve'
2015-04-27T17:49:41.779437+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:819:in `call'
2015-04-27T17:49:41.779439+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
2015-04-27T17:49:41.779440+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
2015-04-27T17:49:41.779442+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
2015-04-27T17:49:41.779443+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/etag.rb:24:in `call'
2015-04-27T17:49:41.779445+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/conditionalget.rb:38:in `call'
2015-04-27T17:49:41.779446+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/head.rb:13:in `call'
2015-04-27T17:49:41.779447+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
2015-04-27T17:49:41.779449+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/flash.rb:260:in `call'
2015-04-27T17:49:41.779451+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/session/abstract/id.rb:225:in `context'
2015-04-27T17:49:41.779452+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/session/abstract/id.rb:220:in `call'
2015-04-27T17:49:41.779453+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/cookies.rb:560:in `call'
2015-04-27T17:49:41.779455+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/query_cache.rb:36:in `call'
2015-04-27T17:49:41.779456+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
2015-04-27T17:49:41.779457+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
2015-04-27T17:49:41.779459+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `call'
2015-04-27T17:49:41.779461+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `_run_callbacks'
2015-04-27T17:49:41.779462+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
2015-04-27T17:49:41.779463+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
2015-04-27T17:49:41.779465+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2015-04-27T17:49:41.779477+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
2015-04-27T17:49:41.779484+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
2015-04-27T17:49:41.779485+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2015-04-27T17:49:41.779487+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:38:in `call_app'
2015-04-27T17:49:41.779488+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `block in call'
2015-04-27T17:49:41.779489+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2015-04-27T17:49:41.779491+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:26:in `tagged'
2015-04-27T17:49:41.779493+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `tagged'
2015-04-27T17:49:41.779494+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `call'
2015-04-27T17:49:41.779496+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2015-04-27T17:49:41.779497+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/methodoverride.rb:22:in `call'
2015-04-27T17:49:41.779499+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/runtime.rb:18:in `call'
2015-04-27T17:49:41.779500+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2015-04-27T17:49:41.779574+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/static.rb:113:in `call'
2015-04-27T17:49:41.779576+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/sendfile.rb:113:in `call'
2015-04-27T17:49:41.779578+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:518:in `call'
2015-04-27T17:49:41.779579+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/application.rb:164:in `call'
2015-04-27T17:49:41.779581+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/lock.rb:17:in `call'
2015-04-27T17:49:41.779582+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/content_length.rb:15:in `call'
2015-04-27T17:49:41.779584+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/handler/webrick.rb:89:in `service'
2015-04-27T17:49:41.779585+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2015-04-27T17:49:41.779587+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2015-04-27T17:49:41.779588+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2015-04-27T17:49:41.779590+00:00 app[web.1]: 
2015-04-27T17:49:41.779591+00:00 app[web.1]: 
2015-04-27T17:49:41.792786+00:00 heroku[router]: at=info method=POST path="/users" host=jonathanmusso-bloccit.herokuapp.com request_id=808366c1-8ba5-46f3-b166-2bb65262fd3d fwd="184.147.57.107" dyno=web.1 connect=1ms service=221ms status=500 bytes=1754

config/initializers/setup_mail.rb

if Rails.env.development?
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
  address:        'smtp.sendgrid.net',
  port:           '587',
  authentication: :plain,
  user_name:      ENV['SENDGRID_USERNAME'],
  password:       ENV['SENDGRID_PASSWORD'],
  domain:         'heroku.com',
  enable_starttls_auto: true
}
end

最佳答案

我不确定您是否在 config/environments/Production.rb 上设置了 SendGrid,它应该看起来像

config.action_mailer.raise_delivery_errors = true config.action_mailer.default_url_options = { :host => 'sitename.com' } config.action_mailer.perform_deliveries = true ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', :端口=>“587”, :身份验证=>:普通, :user_name => ENV['SENDGRID_USERNAME'], :密码 => ENV['SENDGRID_PASSWORD'], :domain => 'heroku.com' } ActionMailer::Base.delivery_method = :smtp

关于ruby-on-rails - Rails Devise 推送到 Heroku:Errno::ECONNREFUSED(连接被拒绝 - connect(2)):,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29902858/

相关文章:

ruby-on-rails - 如何在点击AngularJS设计的前端中的按钮后将数据添加到Rails中的后端?

ruby-on-rails - 未定义的局部变量或方法 `current_user'

javascript - 使用 Rails 创建 powerpoint 演示文稿

ruby-on-rails - Ruby on Rails 命令 rake db :migrate not working using PostgreSQL

Hibernate 无法在 Heroku postgres 上自动创建模式

php - CodeIgniter 3 无法找到您指定的模型

ruby-on-rails - Rails 4.1.x HABTM未定义方法 'foreign_key'

ruby-on-rails - 如何在页面上显示 acts_as_taggable 标签,Rails 中每个标签下面都有帖子?

ruby - 我如何从一组给定的值中进行选择,四舍五入?

ruby - 将复杂文件拆分为哈希