0
我試圖在我的RoR應用程序中使用設計寶石。它工作正常,除了在生產模式下,我無法接收忘記密碼的電子郵件。該頁面顯示此錯誤:拒絕連接拒絕設計忘記密碼,在RoR應用程序部署中
Errno::ECONNREFUSED in Devise::PasswordsController#create
Connection refused - connect(2)
Rails.root: /app
Application Trace | Framework Trace | Full Trace
Request
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"S8rQE7SyT4+7gLvwIiFG+violKPAhzzKMZKUiH0xUSU=",
"user"=>{"email"=>"[email protected]"},
"commit"=>"Send me reset password instructions"}
我要指出:
- 我已經運行在Heroku上的數據庫遷移,沒有任何錯誤。
- 它工作正常發展(電子郵件發送)
- 我使用山魈
- Heroku的日誌顯示某種Heroku的路由器的錯誤:
heroku[router]: at=info method=POST path="https://stackoverflow.com/users/password" host=myappname.herokuapp.com request_id =7e327911-49cb-448a-aa33-13f4bda8c3f dyno=web.1 connect=2ms service=351ms status=500 bytes=1754
我的郵件配置來自production.rb與來自開發的相同.rb:
config.action_mailer.delivery_method = :smtp
# change to true to allow email to be sent during development
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
address: ENV["MAIL_ADDRESS"],
port: 587,
user_name: ENV["MAIL_USERNAME"],
password: ENV["MAIL_PASSWORD"]
}
此外,在production.rb我:
config.action_mailer.default_url_options = { :host => 'myappname.herokuapp.com'}
而在development.rb我:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
的的database.yml文件的樣子這個:
default: &default
adapter: postgresql
user: <%= ENV['DB_USER'] %>
password: <%= ENV['DB_PASSWORD'] %>
pool: 5
timeout: 5000
port: 5432
development:
<<: *default
database: <%= ENV['DB_NAME_DEV'] %>
test:
<<: *default
database: <%= ENV['DB_NAME_TEST'] %>
production:
<<: *default
database: <%= ENV['DB_NAME_PROD'] %>