import tornado
import tornado.ioloop
import tornado.web
import traceback
import urllib
from pyres import ResQ
class Hello():
queue = "Hello"
@staticmethod
def perform(thing):
print "Hello "
class renderui(tornado.web.RequestHandler):
def get(self):
self.render("frontpage.html")
ResQ().enqueue(Hello,"WORLD")
application = tornado.web.Application([
(r"/", renderui),
], debug=True)
if __name__ == "__main__": application.listen(environ.get('PORT',6001))
tornado.ioloop.IOLoop.instance().start()
我也通过了Resq代码,我无法弄清楚出了什么问题。我是python的初学者,试图实现resque,在这方面的帮助将是最受欢迎的。对于上面的代码,我收到以下错误,这里是回溯:
追踪(最近一次呼叫最后一次):
File" /Library/Python/2.7/site-packages/pyres/worker.py" ;,第256行,in 进程返回job.perform()文件 " /Library/Python/2.7/site-packages/pyres/job.py" ;,第67行,执行 payload_class = self.safe_str_to_class(payload_class_str)文件 " /Library/Python/2.7/site-packages/pyres/ init .py",第97行,在 safe_str_to_class引发ImportError('')ImportError