2012-05-16 109 views
2

我正在開發的Rails應用程序在我的本地計算機(MAC)上正常運行。當我把它上傳到服務器版本(CentOS 6.2的Linux,使用Rails 3.2.3和乘客安裝),並嘗試啓動應用程序(通過輸入網址到瀏覽器),我收到以下錯誤信息:Rails:錯誤:數據庫配置沒有指定適配器

Ruby (Rack) application could not be started There appears to be a database problem.

Your application's database configuration file might be written incorrectly. Please check it and fix any errors.

The database server may not be running. Please check whether it's running, and start it if it isn't.

Error message: database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified) Exception class: ActiveRecord::AdapterNotSpecified

請注意,當我運行rake db:createrake db:migrate時,這兩個任務都運行正常,數據庫已正確創建和遷移。

以下是我的database.yml文件:

development: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: acme_development 
    pool: 5 
    username: root 
    password: *********** 
    socket: /tmp/mysql.sock 

test: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: acme_test 
    pool: 5 
    username: root 
    password: ***************** 
    socket: /tmp/mysql.sock 

任何想法?

+0

哪裏是生產配置? –

+0

我把生產拿出來了。乘客是否承擔生產?我認爲開發是默認的,除非我另有指定。 –

+0

我這麼認爲。但我從未使用Passenger。指定您的生產數據庫並執行'rake db:setup RAILS_ENV = production',然後查看它是否有效。 –

回答

3

Phusion乘客默認爲「生產」環境,as documented。它看起來像你假設「發展」。在這種情況下,請設置「RackEnv開發」。

+0

好點。請注意,我們也注意到,當從本地編輯器複製並粘貼database.yml到終端中時,有時候空格/製表符不能正確轉換,因此請確保您的YAML文件結構正確(如在本地機)。 – rcd

相關問題