【发布时间】:2014-02-22 14:15:34
【问题描述】:
我正在更新应用以使用资产编译。
我想尝试以生产模式在本地运行服务器,所以我这样做了
RAILS_ENV=production rails server
它会尝试以生产模式启动:
=> Rails 3.1.8 application starting in production on http://0.0.0.0:3000
但使用
中止=> Ctrl-C to shutdown server
Exiting
/home/durrantm/.rvm/gems/ruby-1.9.3-p194@linker/gems/activerecord-3.1.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection':
Please install the pg adapter: `gem install activerecord-pg-adapter` (cannot load such file -- active_record/connection_adapters/pg_adapter) (RuntimeError)
因为我必须在生产环境中使用 postgres 进行 Heroku 部署。
本地我使用mysql2,本地运行时需要使用那里的数据。
我想我可以暂时删除Gemfile 生产组中的pg 引用并改用mysql,即
group :production
# gem "pg" # Used for Production for heroku.
gem 'mysql2'
end
并且我进行了捆绑安装,但仍然收到 pg 适配器错误 - 即使我的 Gemfile 中没有它并且我已经捆绑。只有 1 个 Gemfile.lock,所以我认为我不需要这样做 RAILS_ENV=production bundle,虽然我当然尝试过 - 它没有帮助。
我的 Gemfile 将 mysql2 列为依赖项而不是 pg
如何让服务器在生产模式下针对我的 mysql 数据库在本地运行?
【问题讨论】:
标签: mysql ruby-on-rails development-environment production-environment pg