bundle exec rake assets:precompile - database configuration does not specify adapter

后端 未结 7 1903
梦毁少年i
梦毁少年i 2020-12-16 18:54

After 24 hours of trying to find the problem with my app. I finally found the problem.

I ran

rake assets:precompile RAILS_ENV=production

7条回答
  •  有刺的猬
    2020-12-16 19:42

    Do this:

    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:
    

    Heroku will overwrite your database.yml with its own version, regardless of what you put in there. However, your rake task running in the Production environment requires a variable, so give it a dummy one.

    As noted above, you can also add 'config.assets.initialize_on_precompile = false' to your production.rb. If set, Heroku requires it be set to 'false'.

提交回复
热议问题