简体   繁体   中英

Push Rails / ClearDB App to Heroku Error 'Can't connect to MySQL server on '127.0.0.1'

Every time I run:

git push heroku master

I get the following error:

Running: rake assets:precompile
rake aborted!
Can't connect to MySQL server on '127.0.0.1'

I am running

rails -v Rails 3.2.11

and

ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]

I have installed ClearDB via Heroku CLI and it seems to work fine, but I can't figure out this error.

Here is my yml for production:

production:
  adapter: mysql2
  encoding: utf8
  host: localhost
  database: pm_production
  username: root
  password: root
  allow_concurrency: true
  pool: 5

Your app is trying to initialize during asset compilation. The heroku docs explicitly recommend you disable app initialization on precompile by modifying your config/application.rb :

config.assets.initialize_on_precompile = false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM