Heroku Cedar - 没有安装Resque前端的静态资产 [英] Heroku Cedar - no static assets for mounted Resque front-end

查看:128
本文介绍了Heroku Cedar - 没有安装Resque前端的静态资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



该应用程序使用Resque和Resque Sinatra前端应用程序,因此我可以监控队列:

 #routes.rb 
...
mount Resque :: Server,:at = > / resque

这很好用,但是当部署到Heroku时, Resque前端的CSS&



Heroku的日志片断表明它返回了零字节:

  ... 
2011-07-13T16:19:35 + 00:00 heroku [路由器]:GET myapp.herokuapp.com/resque/style.css dyno = web .1 queue = 0 wait = 0ms service = 3ms status = 200 bytes = 0
2011-07-13T16:19:35 + 00:00 app [web.1]:
2011-07-13T16 :19:35 + 00:00 app [web.1]:
2011-07-13T16:19:35 + 00:00 app [web.1]:开始GET/resque/style.css 87.xx.xx.xx at 2011-07-13 16:19:35 +0000
2011-07-13T16:19:35 + 00:00 app [web.1]:cache:[GET / resque /style.css] miss

如何获取这些资源?

解决方案

尝试删除路线并将应用程序安装到 config.ru 中。我使用了以下内容:

  require :: File.expand_path('../ config / environment', __FILE__)
需要'resque / server'

运行Rack :: URLMap.new(
/=> Rails.application,
/ resque => Resque :: Server.new


I have a simple Rails app deployed to the Heroku Cedar stack.

The app uses Resque and the Resque Sinatra front-end app is mounted so I can monitor the queue:

# routes.rb
...
mount Resque::Server, :at => "/resque"

This works great, but when deployed to Heroku, the Resque front-end's CSS & JavaScript are not being served.

A snippet of Heroku's logs indicates it's returning zero bytes:

...
2011-07-13T16:19:35+00:00 heroku[router]: GET myapp.herokuapp.com/resque/style.css dyno=web.1 queue=0 wait=0ms service=3ms status=200 bytes=0
2011-07-13T16:19:35+00:00 app[web.1]: 
2011-07-13T16:19:35+00:00 app[web.1]: 
2011-07-13T16:19:35+00:00 app[web.1]: Started GET "/resque/style.css" for 87.xx.xx.xx at 2011-07-13 16:19:35 +0000
2011-07-13T16:19:35+00:00 app[web.1]: cache: [GET /resque/style.css] miss

How can I get it to serve these assets?

解决方案

Try removing the route and mounting the app in your config.ru. I'm using something along the lines of:

require ::File.expand_path('../config/environment',  __FILE__)
require 'resque/server'

run Rack::URLMap.new(
    "/" => Rails.application,
    "/resque" => Resque::Server.new 
)

这篇关于Heroku Cedar - 没有安装Resque前端的静态资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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