rake assets:precompile trying to connect to production database?
-
23-03-2021 - |
Pregunta
$ rake assets:precompile
rake aborted!
could not connect to server: Network is unreachable
Is the server running on host "192.168.163.70" and accepting
TCP/IP connections on port 5432?
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/local/Cellar/ruby/1.9.3-p0/bin/ruby /...]
So I'm trying to precompile assets on my development box. For some reason it tries to connect to the production database (192.168.163.70) and when it fails to do so, it aborts.
Why does it do that and how can I solve the problem?
Solución
I had the following line in one of my Rake task files
require File.expand_path(File.join(File.dirname(__FILE__), '../..', 'config', 'environment'))
Removing it solved the problem.
Otros consejos
check your RAILS_ENV, it must be set to production
at the moment.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow