我想部署使用mysql数据库的我的Rails 4应用程序。数据库位于不同的服务器上。Cloud Foundry - Rails 4 database.yml
我很困惑,应该如何配置我的database.yml文件,以及云代工厂如何知道要使用哪个部分。
部署后,我装我的应用程序
ActiveRecord::AdapterNotSpecified
'' database is not configured. Available: ["development"]
Rails.root: /home/vcap/app
时,如果再刷新页面得到这个错误,你会得到:
NoMethodError
undefined method `default_timezone=' for #<Class:0x007fd7930ab0f0>
Rails.root: /home/vcap/app
我的database.yml是这样的:
#local development
development:
adapter: mysql2
encoding: utf8
host: hostname
port: 3306
database: appdb
username: myapp
password: 'password'
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: &test
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: mysql2
encoding: utf8
host: hostname
port: 3306
database: appdb
username: myapp
password: 'password'
timeout: 5000
我在内部托管CF.部署到开发环境它如何知道要使用什么> – user3437721
意味着你不知道数据库服务器信息? –
云代工厂如何知道使用哪个条目形成database.yml文件 – user3437721