【问题标题】:heroku: internal server errorheroku:内部服务器错误
【发布时间】:2014-08-24 18:21:18
【问题描述】:

您好,我正在将我的代码推送到 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'             

有人能解释一下吗?

【问题讨论】:

    标签: ruby-on-rails heroku


    【解决方案1】:

    我认为解决此问题的最简单方法是生成秘密并推送到您的 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。

    【讨论】:

    • 很好 - 我不知道这个!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-12
    • 1970-01-01
    相关资源
    最近更新 更多