[英]Ruby on Rails: PDF.JS ActionController::RoutingError (No route matches [GET] “/pdf js/web/viewer.html”):
I'm using PDF.js in a rails application from https://github.com/shyammohankanojia/pdfjs_rails . 我正在https://github.com/shyammohankanojia/pdfjs_rails的Rails应用程序中使用PDF.js。 I followed the instructions and everything works fine in development, but in production the viewer doesn't show the pdf.
我遵循了说明,开发中一切正常,但是在生产中,查看器没有显示pdf。
I got the following error: "ActionController::RoutingError (No route matches [GET] "/pdf js/web/viewer.html"):". 我收到以下错误:“ ActionController :: RoutingError(没有与[GET]匹配的路由“ / pdf js / web / viewer.html”):”。
I'm sure that pdf's are uploaded correctly in production. 我确定pdf可以在生产中正确上传。 I ran bundle install and precompiled assets again.
我再次运行捆绑安装和预编译资产。 In development I didn't have to make any changes to routes.rb.
在开发中,我不必对route.rb进行任何更改。
Any thoughts on how can i get the viewer to show the pdf in production? 关于如何让查看者在生产中显示pdf的任何想法?
thanks for your help, i found that changing this line in production.rb "config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?" 感谢您的帮助,我发现在production.rb中更改此行“ config.serve_static_files = ENV ['RAILS_SERVE_STATIC_FILES']。present?” for this one "config.serve_static_files = true" will do the trick
为此,“ config.serve_static_files = true”将达到目的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.