Guest User

Untitled

a guest
Dec 11th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. from tornado.options import define, options
  2. import tornado.web
  3. import tornado.database
  4. import opts
  5.  
  6. class DBHandler(tornado.web.RequestHandler):
  7. def get(self):
  8. db = tornado.database.Connection(options.host, options.database, options.user, options.password)
  9. db.close()
  10.  
  11. application = tornado.web.Application([
  12. (r"/db", DBHandler),
  13. ], debug=True)
  14.  
  15. if __name__ == '__main__':
  16. application.listen(options.port)
  17. tornado.ioloop.IOLoop.instance().start()
Add Comment
Please, Sign In to add comment