i am trying to make epoll work on tornado
import tornado.ioloop
import tornado.web
from tornado.platform.epoll import EPollIOLoop
from tornado import web, gen
class MainHandler(tornado.web.RequestHandler):
@web.asynchronous
@gen.engine
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8888)
EPollIOLoop().start()
but when i start the program and visit the url localhost:8888/ it didn't return anything. is that my system didn't meet the requirement?my linux version was Ubuntu 12.04.1 LTS.
Just use
tornado.ioloop.IOLoop.instance()
. It choose best IOLoop for your platform.You should call
self.finish()
if you useasynchronous
decorator: