Resque 前端无法在 Rails 中加载
我已经设置了 Resque-web 界面来与我的 Rails 3 应用程序配合使用,但它在开发或生产环境中都不起作用。我的设置如下,转到 localhost:3000/resque 只会显示我设置的 404 页面。
Routes.rb
mount Resque::Server.new, :at => "/resque"
Resque 初始值设定项
require 'resque'
require 'resque/server'
if Rails.env.development?
uri = URI.parse(ENV["REDISTOGO_URL"])
Resque.redis = Redis.new(:host => 'localhost', :port => '6379')
else
uri = URI.parse(ENV["REDISTOGO_URL"])
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end
Dir["#{Rails.root.to_s}/app/jobs/*.rb"].each { |file| require file }
Resque::Server.class_eval do
use Rack::Auth::Basic do |email, password|
user = User.authenticate( '[email protected]', 'password' )
user && user.admin?
end
end
I've set up the Resque-web interface to work with my rails 3 app but it doesn't work in either development or production environments. My set up is as follows, and going to localhost:3000/resque just gives me the 404 page I've set up.
Routes.rb
mount Resque::Server.new, :at => "/resque"
Resque initializer
require 'resque'
require 'resque/server'
if Rails.env.development?
uri = URI.parse(ENV["REDISTOGO_URL"])
Resque.redis = Redis.new(:host => 'localhost', :port => '6379')
else
uri = URI.parse(ENV["REDISTOGO_URL"])
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end
Dir["#{Rails.root.to_s}/app/jobs/*.rb"].each { |file| require file }
Resque::Server.class_eval do
use Rack::Auth::Basic do |email, password|
user = User.authenticate( '[email protected]', 'password' )
user && user.admin?
end
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的
routes.rb
文件有:也许您忘记了
routes.rb
文件中的require
?我没有 resque 初始化程序,所以我不知道这是否会导致您的问题。
My
routes.rb
file has:Maybe you forgot the
require
inside theroutes.rb
file?I do not have a resque initializer, so I don't know if that is causing your problem or not.
我有一条将
'/:name'
与'model#index'
路线相匹配的路线,这一定会让 Resque 感到困惑,所以我刚刚将其安装到'/ resque/web'
I have a route that matches
'/:name'
to a'model#index'
route must be confusing Resque so I've just mounted it to'/resque/web'