使用Unicorn进行生产中的回形针:未初始化的常量回形针(NameError) [英] Paperclip in Production with Unicorn: uninitialized constant Paperclip (NameError)

查看:120
本文介绍了使用Unicorn进行生产中的回形针:未初始化的常量回形针(NameError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Paperclip添加到了我的应用程序,然后尝试使用capistrano部署到我的VPS。部署成功完成,但是当我尝试在VPS上访问我的应用程序时,出现了Rails错误页面。
production.log 中没有信息,但是 unicorn.log 具有以下错误:

I added Paperclip to my app then tried to deploy to my VPS using capistrano. The deploy happens successfully, but when I try to access my app on the VPS, I get the Rails Error Page. There is no information in production.log, but unicorn.log has the following error:

E, [2013-06-25T19:44:07.372060 #21995] ERROR -- : uninitialized constant Paperclip (NameError)
/home/deployer/apps/arcsite/releases/20130625182331/config/initializers/paperclip.rb:1:in `<top (required)>'

初始化文件为 paperclip.rb ,并具有以下内容:

The initializer file is paperclip.rb and has these contents:

Paperclip.interpolates :zone do |attachment, style|
  attachment.instance.zone_id
end

这是让我使用我想要的文件夹结构。

It's an interpolater to allow me to use the folder structure I want.

如果删除 paperclip.rb 初始化程序文件,则会收到一条错误消息 has_attachment 在我的课程中未定义,使得回形针 gem似乎没有正确加载。

If I remove the paperclip.rb initializer file, I get an error that has_attachment is undefined in my class, making it seem like the paperclip gem isn't being properly loaded.

我尝试卸载/重新安装gem,但是当我运行 gem卸载回形针时,它告诉我回形针是未安装。当我运行 bundle show paperclip 时,它确实显示了一个目录(我正在使用RVM),所以我用 gem install paperclip 。我仍然遇到相同的错误。

I tried to uninstall/reinstall the gem, but when I ran gem uninstall paperclip, it told me that the paperclip gem was not installed. When I ran bundle show paperclip it did show a directory (I'm using RVM), so I manually installed the paperclip gem with gem install paperclip. I'm still getting the same error.

该应用在 thin 服务器上的开发中运行良好。

This app works fine in development on the thin server.

我的VPS设置:


  • nginx

  • unicorn

  • rvm

  • capistrano

  • nginx
  • unicorn
  • rvm
  • capistrano

轨道版本:3.2.13
回形针版本:3.4.2

rails version: 3.2.13 paperclip version: 3.4.2

我关注了赖安(Ryan)的截屏视频,以设置nginx / unicorn

推荐答案

原来是一些奇怪的安装行为。必须与RVM人员合作,并更新了rvm capistrano文档以反映新过程。

Turns out it was some weird installation behavior. Had to work with the RVM people and have updated the rvm capistrano documentation to reflect the new procedures.

这篇关于使用Unicorn进行生产中的回形针:未初始化的常量回形针(NameError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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