Rails 3 - 移动到/启动生产服务器 - 生产数据库未配置?
我正在寻求部署我的第一个 Rails 应用程序,但遇到了一些问题。首先,开发服务器中一切正常,所以我想我已经可以开始了。在无法将应用程序部署到我的主机后,我第一次尝试在生产模式下启动服务器,收到几个错误。
出于好奇,我创建了一个新的应用程序,完全新鲜,无需编辑任何代码。我的数据库遇到了几乎相同的错误:
/home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:in `establish_connection': =production database is not configured (ActiveRecord::AdapterNotSpecified)
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/railtie.rb:59:in `block (2 levels) in <class:Railtie>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/railtie.rb:57:in `block in <class:Railtie>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /home/sweiss/testapp/config/environment.rb:6:in `<top (required)>'
from /home/sweiss/testapp/config.ru:3:in `require'
from /home/sweiss/testapp/config.ru:3:in `block in <main>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
from /home/sweiss/testapp/config.ru:1:in `new'
from /home/sweiss/testapp/config.ru:1:in `<main>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:162:in `app'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:213:in `start'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/server.rb:65:in `start'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
有人在尝试启动生产服务器时遇到过这种情况吗?为了更好的衡量,database.yml 是 sqlite3 的以下默认值:
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
我验证了 .yml 没有选项卡(并不是说它应该自动生成)。
不管怎样,我很感谢你的帮助。
I was looking to deploy my first rails app, and have been experiencing some issues. First off, everything works fine in the development server, so I figured I was good to go. After failed to deploy the app to my host, I tried to launch the server in production mode for the first time, receiving several errors.
Out of curiousity, I created a new app, completely fresh without me editing any code. I'm getting pretty much the same errors about my database:
/home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:in `establish_connection': =production database is not configured (ActiveRecord::AdapterNotSpecified)
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/railtie.rb:59:in `block (2 levels) in <class:Railtie>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.3/lib/active_record/railtie.rb:57:in `block in <class:Railtie>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /home/sweiss/testapp/config/environment.rb:6:in `<top (required)>'
from /home/sweiss/testapp/config.ru:3:in `require'
from /home/sweiss/testapp/config.ru:3:in `block in <main>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
from /home/sweiss/testapp/config.ru:1:in `new'
from /home/sweiss/testapp/config.ru:1:in `<main>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:162:in `app'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/server.rb:213:in `start'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/server.rb:65:in `start'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
from /home/sweiss/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Has anyone experiences this while trying to launch a production server? The database.yml, just for good measure, is the following default for sqlite3:
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
I verified the .yml had no tabs (not that it should auto-generated).
Anyway, I appreciate the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你安装了 sqlite3 gem 吗?我觉得好像找不到适配器。
Have you installed the sqlite3 gem? Sounds to me like it can't find the adapter.