将Rails / ClearDB应用程序推送到Heroku错误'无法连接到'127.0.0.1'上的MySQL服务器

时间:2021-10-23 00:10:38

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.

我已经通过Heroku CLI安装了ClearDB,它似乎工作正常,但我无法弄清楚这个错误。

Here is my yml for production:

这是我的yml用于制作:

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

1 个解决方案

#1


17  

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:

您的应用正在尝试在资产编译期间初始化。 heroku文档明确建议您通过修改config / application.rb来禁用预编译上的应用程序初始化:

config.assets.initialize_on_precompile = false

#1


17  

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:

您的应用正在尝试在资产编译期间初始化。 heroku文档明确建议您通过修改config / application.rb来禁用预编译上的应用程序初始化:

config.assets.initialize_on_precompile = false