【问题标题】:Rails application heroku ErrorRails应用程序heroku错误
【发布时间】:2016-04-01 12:31:47
【问题描述】:

导轨 4.1.5 红宝石 2.1.2p95 MongoDB - 2.4.13

它在本地系统中工作文件,但是在部署 heroku 时它出错了

mongodb.yml

production:
  sessions:
    default:
      uri: <%= ENV['MONGOHQ_URL'] %>
      options:
        consistency: :strong
        max_retries_on_connection_failure: 20
        persist_in_safe_mode: true
        skip_version_check: true

这里是heroku日志

> 2015-12-27T11:48:46.350015+00:00 app[web.1]: Processing by UsersController#index as HTML
2015-12-27T11:48:48.870124+00:00 heroku[router]: at=info method=GET path="/users" host=lit-fjord-5279.herokuapp.com request_id=02419aa9-43c9-4446-b8e9-8a9f7a441b40 fwd="122.172.61.174" dyno=web.1 connect=13ms service=9ms status=500 bytes=1754
2015-12-27T11:48:48.870017+00:00 app[web.1]: Started GET "/users" for 122.172.61.174 at 2015-12-27 11:48:48 +0000
2015-12-27T11:48:48.873238+00:00 app[web.1]:   Rendered users/index.html.erb within layouts/application (0.9ms)
2015-12-27T11:48:48.873359+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2015-12-27T11:48:48.874438+00:00 app[web.1]: 
2015-12-27T11:48:48.874441+00:00 app[web.1]: ActionView::Template::Error (
2015-12-27T11:48:48.874442+00:00 app[web.1]: message:
2015-12-27T11:48:48.874443+00:00 app[web.1]:   No configuration could be found for a client named 'default'.
2015-12-27T11:48:48.874444+00:00 app[web.1]: summary:
2015-12-27T11:48:48.874445+00:00 app[web.1]:   When attempting to create the new client, Mongoid could not find a client configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect.
2015-12-27T11:48:48.874446+00:00 app[web.1]: resolution:
2015-12-27T11:48:48.874446+00:00 app[web.1]:   Double check your mongoid.yml to make sure under the clients key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.):
2015-12-27T11:48:48.874447+00:00 app[web.1]:     10:   </thead>
2015-12-27T11:48:48.874450+00:00 app[web.1]:     14:       <tr>
2015-12-27T11:48:48.874450+00:00 app[web.1]:     15:         <td><%= user.name %></td>
2015-12-27T11:48:48.874451+00:00 app[web.1]:     16:         <td><%= user.email %></td>
2015-12-27T11:48:48.874448+00:00 app[web.1]:     11: 
2015-12-27T11:48:48.874448+00:00 app[web.1]:     12:   <tbody>
2015-12-27T11:48:48.874449+00:00 app[web.1]:     13:     <% @users.each do |user| %>
2015-12-27T11:48:48.874452+00:00 app[web.1]:   app/views/users/index.html.erb:13:in `_app_views_users_index_html_erb__1900358265610175239_69916668256060'
2015-12-27T11:48:48.874453+00:00 app[web.1]: 
2015-12-27T11:48:48.874453+00:00 app[web.1]: 

【问题讨论】:

    标签: ruby-on-rails mongodb heroku


    【解决方案1】:

    错误:

    仔细检查您的 mongoid.yml 以确保在客户端键下存在“默认”配置

    文件名:

    mongodb.yml

    其中一件事与另一件事不同。尝试将文件重命名为 mongoid.yml

    Mongoid Tutorial, configuration

    【讨论】:

      猜你喜欢
      • 2014-11-19
      • 2014-03-12
      • 2015-10-31
      • 2013-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多