莺:我的影像在哪里 [英] Warbler: Where are my images

查看:92
本文介绍了莺:我的影像在哪里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jruby和Warbler将Jruby on Rails应用程序部署到Tomcat服务器.使用Webrick部署服务器时,我可以看到所有图像:jruby -S服务器/脚本.但是,当我使用jruby -S warble在rails目录之外创建.war文件并部署到Tomcat时,tomcat服务器上没有显示我的图像.我注意到映像位置已更改为war文件中目录的根目录.

I'm using Jruby and Warbler to deploy a Jruby on Rails application to a Tomcat server. I can see all of my images when I deploy the server with Webrick: jruby -S server/script. However, when I create a .war file out of the rails directory using jruby -S warble and deploy to Tomcat, none of my images show up on the tomcat server. I noticed that image location has changed to the root of the directory in the war file.

/images/picturename.jpg似乎合适,但我的图像没有显示出来.

It seems that /images/picturename.jpg would be appropriate, but my images are not showing up.

推荐答案

未显示"-> 404?您说您注意到图像位置已更改,是否检查了特定图像? (jar tf myapp.war将显示给您.)

"not showing up" -> 404? You said you noticed the image location changed, did you check that the specific images are present? (jar tf myapp.war will show you.)

您是否在上下文路径下部署了战争?也就是说,如果主页位于/myapp/,则图片将位于/myapp/images/picturename.jpg. JRuby-Rack尝试为您调整Rails资产路径以包括上下文路径,但是在某些情况下可能没有.您可能还希望仅将config/environments/production.rb中的config.action_controller.asset_host设置为'/myapp'.

Did you deploy your war under a context path? I.e., if the home page is at /myapp/, then images will be at /myapp/images/picturename.jpg. JRuby-Rack tries to adjust the Rails asset paths for you to include the context path, but there may be some cases where it doesn't. You may want to resort to just setting config.action_controller.asset_host in config/environments/production.rb to '/myapp' as well.

这篇关于莺:我的影像在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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