Ben*_*min 9 postgresql ruby-on-rails
24小时后,我试图找到我的应用程序的问题.我终于找到了问题.
我跑了
rake assets:precompile RAILS_ENV=production
Run Code Online (Sandbox Code Playgroud)
我一直在收到这个错误.
/Users/vezu/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /Users/vezu/.rvm/gems/ruby-1.9.3-p194@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
database configuration does not specify adapter
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/vezu/.rvm/rubies/ruby-1.9.3-p194/bi...]
Run Code Online (Sandbox Code Playgroud)
我的database.yml文件看起来像这样
development:
adapter: postgresql
host: localhost
encoding: unicode
database: ndoda_development
pool: 5
username:
password:
test:
adapter: postgresql
encoding: unicode
database: ndoda_test
pool: 5
Run Code Online (Sandbox Code Playgroud)
Ben*_*min 29
简单的解决方案是在我的application.rb中添加一个简单的行
config.assets.initialize_on_precompile = false
Run Code Online (Sandbox Code Playgroud)
一切正常.
做这个:
development:
adapter: postgresql
host: localhost
encoding: unicode
database: ndoda_development
pool: 5
username:
password:
test:
adapter: postgresql
encoding: unicode
database: ndoda_test
pool: 5
# Add the below...
production:
adapter: postgresql
host: localhost
encoding: unicode
database: ndoda_production
pool: 5
username:
password:
Run Code Online (Sandbox Code Playgroud)
Heroku将使用自己的版本覆盖您的database.yml,无论您放在那里.但是,在生产环境中运行的rake任务需要一个变量,因此请给它一个虚拟变量.
如上所述,您还可以将"config.assets.initialize_on_precompile = false"添加到production.rb.如果设置,Heroku要求将其设置为"false".
| 归档时间: |
|
| 查看次数: |
15925 次 |
| 最近记录: |