def __init__(self): self.db_session = get_db_session() site_handlers = get_site_handlers() tornado_settings = { 'xsrf_cookies': False, 'gzip': True, 'debug': True, 'secret_key': 'RhXUowgi553yJYvM18xGNc', } tornado.web.Application.__init__(self, site_handlers, **tornado_settings)
def __init__(self): self.db_session = get_db_session() site_handlers = get_site_handlers() tornado_settings = { 'xsrf_cookies': False, 'gzip': True, 'debug': True, 'secret_key': 'RhXUowgi553yJYvM18xGNc', } tornado.web.Application.__init__( self, site_handlers, **tornado_settings)
def adduser(username, password, email, is_superuser=False): db = get_db_session() user = create_user(db, username=username, password=password, email=email) if user: if username == 'admin' or is_superuser: user.is_superuser = True db.commit() logging.debug('Create user "{0}" success.'.format(username)) else: logging.error('Create user {0} failed'.format(username)) db.remove()
def __init__(self): self.db_session = get_db_session() self.es = Elasticsearch([{ 'host': settings.ELATICSEARCH_HOST, 'port': settings.ELATICSEARCH_PORT }]) site_handlers = get_site_handlers() tornado_settings = { 'xsrf_cookies': False, 'gzip': True, 'debug': True, 'secret_key': 'RhXUowgi553yJYvM18xGNc', } tornado.web.Application.__init__(self, site_handlers, **tornado_settings)