Esempio n. 1
0
def main(loop,**kw):
	yield from orm.create_pools(loop = loop, pool_size=5, **kw)
	# s = yield from Users.findAll()
	# s[0].name='fanlizhou'
	# yield from s[0].update()
	user = Users(email='*****@*****.**', password='******', admin=0, name='ccc', image='about:_blank')
	yield from user.save()
Esempio n. 2
0
def init(loop):
	
	app = web.Application(loop = loop,middlewares=[
		logger_factory,
		auth_factory,
		response_factory
	])
	yield from orm.create_pools(loop=loop,pool_size=4,**configs.database)
	init_jinja2(app, filters=dict(datetime=datetime_filter))
	
	add_routes(app, 'handlers')
	add_static(app)
	server = yield from loop.create_server(app.make_handler(),'localhost',9000)
	logging.info('server started at http://localhost:9000')
	return server