简体   繁体   English

由bundle exec修复的Rake错误,但部署不起作用

[英]Rake error fixed by bundle exec, but deployment not working

I pushed an update to my Rails app production server, and in the update there was a new database migration. 我将更新推送到我的Rails应用程序生产服务器,并在更新中有一个新的数据库迁移。 I ran rake db:migrate and got the common error seen here . 我运行rake db:migrate并得到了这里看到的常见错误。 I ran the rake again in bundle exec bash and it was successful. 我在bundle exec bash再次运行rake并且它成功了。 But after restarting my apache server, I'm now getting the 500 Error page. 但重新启动我的apache服务器后,我现在收到了500错误页面。 This update worked fine on my localhost, and was mostly this update to the db with supporting changes in the according view and controller/routing. 此更新在我的localhost上工作正常,并且主要是对数据库的此更新,并在相应视图和控制器/路由中支持更改。

I don't even know why this error appeared this time, as I have pushed db updates successfully before using only rake . 我甚至不知道为什么这次出现这个错误,因为我在仅使用rake之前已经成功推送了db更新。 Nonetheless, the rake was successful. 尽管如此,耙子还是成功的。 The 500 error page only shows on pages that require that specific new ActiveRecord. 500错误页面仅显示在需要特定新ActiveRecord的页面上。 Any ideas on how to debug? 关于如何调试的任何想法?

EDIT: My problem was an extremely simple one. 编辑:我的问题非常简单。 I merely forgot to include the environment with the rake: 我只是忘了用耙子包括环境:

bundle exec rake db:migrate RAILS_ENV=production

Unfortunately, it took quite a while to narrow that down, as I couldn't use IRB to check the db entries until I followed these steps . 不幸的是,为了缩小范围,需要花费很长时间,因为在我按照这些步骤操作之前,我无法使用IRB来检查数据库条目。

Did you run rake db:migrate on your server? 你在服务器上运行了rake db:migrate吗? Also be sure to set the RAILS_ENV flag so your production database is updated: 还要确保设置RAILS_ENV标志,以便更新生产数据库:

rake db:migrate RAILS_ENV=production

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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