Rails3程序在产品模式下出现assert文件404错误的问题
来源:互联网 发布:linux ssh开启 编辑:程序博客网 时间:2024/05/20 10:54
rails3程序部署产品模式之后
出现以下静态文件错误这个问题看上去像是assert资源的问题,首先要确保下面这个命令运行,编译静态文件 我上面处先的问题是在这一步之后,我的启动方式,是 开发模式样式表,js什么的都有,但是产品模式下就是上面那个问题了。
原因在下面:上面是产品模式的配置,开发模式默认是没有这个选项的。
解决方案有两种:
方法一:是把上面那一行配置改成 true
方法二:是搭建nginx或者apache服务器,ngxin和apache会直接读取静态文件,不会产生这个问题
这是来自stackoverflow上的答案
出现以下静态文件错误
Ruby代码:
- 17:14:26 INFO: Started GET "/assets/application-b42d228d39a3e30c7479d7bf2fd1709b.js" for 10.0.2.2 at 2013-03-07 17:14:26 +0800
- 17:14:26 FATAL:
- ActionController::RoutingError (No route matches [GET] "/assets/application-b42d228d39a3e30c7479d7bf2fd1709b.js"):
- actionpack (3.2.9) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
- actionpack (3.2.9) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
- railties (3.2.9) lib/rails/rack/logger.rb:32:in `call_app'
- railties (3.2.9) lib/rails/rack/logger.rb:18:in `call'
Ruby代码:
- bundle exec rake assets:precompile
Ruby代码:
- rails s
原因在下面:
Ruby代码:
- # config/environments/production.rb
- ...
- config.serve_static_assets = false
- ...
解决方案有两种:
方法一:是把上面那一行配置改成 true
方法二:是搭建nginx或者apache服务器,ngxin和apache会直接读取静态文件,不会产生这个问题
这是来自stackoverflow上的答案
引用
In production mode, Rails will not be responsible for serving static assets. Therefore, you are getting this error. Thin won't do it either, since it's just a wrapper around Rails.
This is controlled by this setting in config/environment/production.rb in your application:
config.serve_static_assets = false
You can either set to that true or use a real server like Apache or Nginx which will serve the static assets. I suspect Pow may also do it.
share|improve this answer
This is controlled by this setting in config/environment/production.rb in your application:
config.serve_static_assets = false
You can either set to that true or use a real server like Apache or Nginx which will serve the static assets. I suspect Pow may also do it.
share|improve this answer
其访问地址http://stackoverflow.com/questions/7829480/no-route-matches-get-assets
原文链接:http://www.software8.co/wzjs/qtyy/3255.html
- Rails3程序在产品模式下出现assert文件404错误的问题
- Rails3.2 下使用 plugin出现的问题
- vc程序在执行时出现assert错误,救命!!!!
- Rails3的部署问题
- java程序在linux下出现的乱码问题
- assert在release版本下也执行的问题
- 关于assert函数在debug 和release下的问题
- 解决在linux下编译32程序出现“/usr/include/gnu/stubs.h:7:27: 致命错误:gnu/stubs-32.h:没有那个文件或目录问题”
- 解决在linux下编译32程序出现“/usr/include/gnu/stubs.h:7:27: 致命错误:gnu/stubs-32.h:没有那个文件或目录问题”
- Rails3.1在windows连接Mysql的问题
- windows下编辑脚本文件在linux下出现错误
- 在VC6下编译MTL程序,出现的C4786错误的原因和解决办法
- 关于silverlight3程序在win7 ie8环境下运行出现跨域的错误
- 在VS2012下的CUDA程序中出现错误error : identifier “atomicAdd” is undefined
- qtcreator 程序在xp下出现Failed to load platform plugin “windows”的错误
- 在VS2010下的CUDA程序中出现错误error : identifier “atomicAdd” is undefined
- vs2015在Debug模式下运行出现"应用程序无法正常启动(0x000007b)"的错误解决方法
- 解决ajax程序访问服务器返回的XML文件时, firebug出现: XML 解析错误问题
- 陈淙靓是个农民!
- FFT算法MATLAB实现与测试
- 软件项目管理系统-账务管理-项目收款
- 有了接口,微信什么都能做
- Windows下mysql忘记root密码解决方法
- Rails3程序在产品模式下出现assert文件404错误的问题
- POJ 3026 广搜+最小生成树
- JSP/Servlet:tomcat深入内部结构描述
- UltraISO 写入 U 盘安装 Ubuntu
- WordPress提交评论后自动跳转到“Thank you” 页面
- [Leetcode] Maximum Subarrary
- 你中招了吗?iOS应用泄露隐私比安卓严重
- Android Custom Dialog错误Unable to add window -- token null is not for an application
- srm144div2P200简单题