Rails 3.1 assets:precompile Connecting to Database

此生再无相见时 提交于 2019-12-08 00:15:03

问题


I'm trying to deploy an application to Heroku after upgrading to Rails 3.1 with the asset pipeline. I ran into the common issue mentioned on Heroku's troubleshooting page when receiving the error:

could not connect to server: Connection refused 
Is the server running on host "127.0.0.1" and accepting 
TCP/IP connections on port xxxx?

I took the suggestions on the page and added the following to my config/application.rb file (after also trying to add it to the individual [environment].rb files to no effect)

config.assets.initialize_on_precompile = false

I've modified my database.yml file to point my production environment to a non-existant database, but when running the assets:precompile task locally, I get the following:

> RAILS_ENV=production bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
FATAL:  database "my_nonexistant_database" does not exist

Tasks: TOP => environment
(See full trace by running task with --trace)

I'm trying to figure out what part of my application is trying to initialize the database so that I can fix it, but I've run out of ideas for getting more debugging information than this.

Anyone have any tips for either getting more information about where my app is trying to init the DB, or for fixing the underlying problem?


回答1:


You should try the new labs feature http://devcenter.heroku.com/articles/labs-user-env-compile which will make variables available at slug compile time.



来源:https://stackoverflow.com/questions/8728257/rails-3-1-assetsprecompile-connecting-to-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!