从 RAILS_ROOT 外部运行 rake 任务 [英] Run rake task from outside RAILS_ROOT

查看:45
本文介绍了从 RAILS_ROOT 外部运行 rake 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 RAILS_ROOT 是/usr/local/www/application/

My RAILS_ROOT is /usr/local/www/application/

如果我从 RAILS_ROOT 中运行rake db:migrate RAILS_ENV=production",它工作正常.

If I run 'rake db:migrate RAILS_ENV=production" from within the RAILS_ROOT it works fine.

但是我似乎找不到从 RAILS_ROOT 外部运行相同命令的方法.

However I can't seem to find a way to run the same command from outside the RAILS_ROOT.

推荐答案

尝试:

rake -f $RAILS_ROOT/Rakefile db:migrate RAILS_ENV=production
# Assuming you set the environment variable. 
# Else, just replace $RAILS_ROOT by actual value

这篇关于从 RAILS_ROOT 外部运行 rake 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆