示例#1
0
 def __init__(self):
     handlers = [
         (r'/', WebHandler),
         (r'/ws', SocketHandler),
     ]
     settings = dict(
         title='Tornado Poker',
         cookie_secret='fiDSpuZ7QFe8fm0XP9Jb7ZIPNsOegkHYtgKSd4I83Hs=',
         template_path=os.path.join(BASE_DIR, 'static'),
         static_path=os.path.join(BASE_DIR, 'static'),
         login_url='/',
         xsrf_cookies=True,
         debug=True,
     )
     super(Application, self).__init__(handlers, **settings)
     self.db = torndb.Connection(
         host='localhost',
         database='ddz',
         user='******',
         password='******')
     self.executor = ThreadPoolExecutor()
示例#2
0
 def __init__(self):
     handlers = [
         (r'/', WebHandler),
         (r'/update', UpdateHandler),
         (r'/reg', RegHandler),
         (r'/ws', SocketHandler),
     ]
     settings = dict(
         title='Tornado Poker',
         cookie_secret='fiDSpuZ7QFe8fm0XP9Jb7ZIPNsOegkHYtgKSd4I83Hs=',
         template_path=os.path.join(BASE_DIR, 'static'),
         static_path=os.path.join(BASE_DIR, 'static'),
         login_url='/',
         xsrf_cookies=True,
         debug=True,
     )
     tornado.options.parse_config_file("server.conf")
     super(Application, self).__init__(handlers, **settings)
     self.db = torndb.Connection(host=options.host,
                                 database=options.database,
                                 user=options.user,
                                 password=options.password)
     self.executor = ThreadPoolExecutor()
示例#3
0
文件: app.py 项目: thomposer/doudizhu
 def __init__(self):
     super().__init__(url_patterns, **settings)
     self.db = torndb.Connection(**DATABASE)
     self.executor = ThreadPoolExecutor()