我想部署使用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