There is a server request handler:
import tornado.web from tornado import gen from tornado.ioloop import IOLoop class MainHandler(tornado.web.RequestHandler): @tornado.web.asynchronous @tornado.gen.coroutine def post(self): ...do something with request... It starts from another file, with the construction:
import tornado.web from tornado.ioloop import IOLoop from logger import Logger app_settings = dict( debug=True, ) application = tornado.web.Application([ (r"/", MainHandler) ], **app_settings) if __name__ == '__main__': try: object = Logger() application.listen(8888) print('Server Running...') print('Press ctrl + c to close') IOLoop.instance().start() except KeyboardInterrupt: print('Server is out') How, using the tornado web framework, to transfer to
class MainHandler(tornado.web.RequestHandler): argument (object), as a parameter? Is it possible to use singleton?