heroku:内部服务器错误

时间:2014-08-24 10:02:33

标签: ruby-on-rails heroku

您好我正在将我的代码推送到heroku并且我收到了"internal server error",还有一条消息"您必须在应用的配置中设置config.secret_key_base。"

附件是我的heroku日志:

2014-08-24T09:59:08.327640+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=morning-shore-7679.herokuapp.com request_id=
41ececcc-6a0d-4af1-832c-c0123335836a fwd="10.168.82.110  ,220.255.1.160" dyno=web.1 connect=1ms service=6ms status=500 bytes=562         
2014-08-24T09:59:08.326020+00:00 app[web.1]: [2014-08-24 09:59:08] ERROR RuntimeError: You must set config.secret_key_base in your app's 
config.                                                                                                                                  
2014-08-24T09:59:08.326025+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:145:in `env_co
nfig'                                                                                                                                    
2014-08-24T09:59:08.326027+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/engine.rb:507:in `call'      
2014-08-24T09:59:08.326028+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:97:in `call'  
2014-08-24T09:59:08.326032+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'    
2014-08-24T09:59:08.326030+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'              
2014-08-24T09:59:08.326034+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-08-24T09:59:08.326035+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'             
2014-08-24T09:59:08.326038+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'   
2014-08-24T09:59:08.326037+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'             

任何人都可以对此有所了解吗?

1 个答案:

答案 0 :(得分:2)

我认为解决这个问题的最简单方法是生成秘密并推入你的git仓库。

# on terminal from project root
rake secret

将此生成的秘密放在config/initializers/secret_token.rb文件中:

# Be sure to restart your server when you modify this file.

Yourapp::Application.config.secret_token = 'YOUR_GENERATED_SECRET'

承诺&将代码推送到heroku。