当前位置: 首页>>代码示例>>Python>>正文


Python orm.create_pool方法代码示例

本文整理汇总了Python中orm.create_pool方法的典型用法代码示例。如果您正苦于以下问题:Python orm.create_pool方法的具体用法?Python orm.create_pool怎么用?Python orm.create_pool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在orm的用法示例。


在下文中一共展示了orm.create_pool方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def init(loop):
    # ????????
    await orm.create_pool(loop=loop, host='127.0.0.1', port=3306, user='www', password='www', db='awesome')
    # ??app???????????????middlewares
    app = web.Application(loop=loop, middlewares=[
        logger_factory, auth_factory, response_factory
    ])
    # ???jinja2???????????
    init_jinja2(app, filters=dict(datetime=datetime_filter))
    # ????????coroweb???
    add_routes(app, 'handlers')  # handlers???handlers?????handlers.py
    add_static(app)
    srv = await loop.create_server(app.make_handler(), '127.0.0.1', 9000)
    logging.info('server started at http://127.0.0.1:9000...')
    return srv



# asyncio????????????????????asyncio?????????eventloop??????????//
# ????????????eventloop??????????IO
# ??????eventloop

# get_event_loop()????python????18.5.2.5
# get_event_loop() => ?????????????????event loop??(????????'asyncio.windows_events._WindowsSelectorEventLoop')???AbstractEventLoop???????????
# ????????????????????get_event_loop()??????None 
开发者ID:ReedSun,项目名称:Preeminent,代码行数:27,代码来源:app.py

示例2: init

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def init(loop):
    app_port = 8080
    database_port = 3306
    host = '127.0.0.1'
    yield from orm.create_pool(
        loop=loop,
        host=host,
        port=database_port,
        user='root',
        password='czh',
        db='weppy'
    )
    app = web.Application(loop=loop, middlewares=[
        logger_factory, response_factory, auth_factory
    ])
    init_jinja2(app,)
    add_routes(app, 'apis')
    add_routes(app, 'blog')
    add_routes(app, 'controller')
    add_static(app)

    srv = yield from loop.create_server(app.make_handler(), host, app_port)
    logging.info('server started at {}:{}...'.format(host, app_port))
    return srv 
开发者ID:seniorcandy,项目名称:Weppy,代码行数:26,代码来源:app.py

示例3: init

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def init(loop):
    # ????????
    await orm.create_pool(loop=loop, host='127.0.0.1', port=3306, user='root', password='123456', db='awesome')
    # ??app???????????????middlewares
    app = web.Application(loop=loop, middlewares=[
        logger_factory, auth_factory, response_factory
    ])
    # ???jinja2???????????
    init_jinja2(app, filters=dict(datetime=datetime_filter))
    # ????????coroweb???
    add_routes(app, 'handlers')  # handlers???handlers?????handlers.py
    add_static(app)
    srv = await loop.create_server(app.make_handler(), '127.0.0.1', 9000)
    logging.info('server started at http://127.0.0.1:9000...')
    return srv



# asyncio????????????????????asyncio?????????eventloop??????????//
# ????????????eventloop??????????IO
# ??????eventloop

# get_event_loop()????python????18.5.2.5
# get_event_loop() => ?????????????????event loop??(????????'asyncio.windows_events._WindowsSelectorEventLoop')???AbstractEventLoop???????????
# ????????????????????get_event_loop()??????None 
开发者ID:lilizhiwei,项目名称:python1,代码行数:27,代码来源:app.py

示例4: init

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def init(loop):
	await orm.create_pool(loop=loop,**configs.db)
	app = web.Application(loop=loop,middlewares=[logger_factory,auth_factory,response_factory])
	init_jinja2(app,filters=dict(datetime=datetime_filter))
	add_routes(app,'handlers')
	add_static(app)
	srv = await loop.create_server(app.make_handler(),'127.0.0.1',9000)
	logging.info('server started at http://127.0.0.1:9000...')
	return srv 
开发者ID:syusonn,项目名称:awesome-python3-webapp,代码行数:11,代码来源:app.py

示例5: connecDB

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def connecDB(loop):
	username = 'root'
	password = 'root'
	dbname = 'pydb'
	await orm.create_pool(loop,user=username,password=password,db=dbname) 
开发者ID:syusonn,项目名称:awesome-python3-webapp,代码行数:7,代码来源:orm_test.py

示例6: init

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def init(loop):
    #app = web.Application(loop = loop, host = '127.0.0.1', port = 3306, user = 'root', password = '123', database = 'awesome')
    yield from orm.create_pool(loop = loop, host = '127.0.0.1', port = 3306, user = 'root', password = '123', database = 'awesome')
    app = web.Application(loop = loop, middlewares = [
        logger_factory, auth_factory, response_factory
    ])
    init_jinja2(app, filters = dict(datetime = datetime_filter))
    add_routes(app, 'handlers')
    add_static(app)
    #app.router.add_route('GET', '/', index)
    srv = yield from loop.create_server(app.make_handler(), '::', 8080)
    logging.info('Server started at http://127.0.0.1:8080...')
    return srv 
开发者ID:tianzhenyun,项目名称:python-awesome-web,代码行数:15,代码来源:app.py

示例7: test

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def test():
    yield from orm.create_pool(loop, host='127.0.0.1', port = 3306, user='root', password='123', database='awesome')

    u = User(name='Test', email = '[email protected]', password = '123', image = 'about:blank')

    yield from u.save()
    #yield from orm.destory_pool() 
开发者ID:tianzhenyun,项目名称:python-awesome-web,代码行数:9,代码来源:tmp.py

示例8: test

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def test(loop):
    await orm.create_pool(loop=loop,user='www-data', password='www-data', db='awesome')

    u=User(name='test20',email='[email protected]',passwd='test',image='about:blank')

    await u.save() 
开发者ID:ReedSun,项目名称:Preeminent,代码行数:8,代码来源:test.py

示例9: find

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def find():
    await orm.create_pool(loop, user='root', password='password', db='awesome')
    all = await User.findAll()
    print(all)
    pk = await User.find('00149276202953187d8d3176f894f1fa82d9caa7d36775a000')
    print(pk)
    num = await User.findNumber('email')
    print(num)
    await orm.destory_pool() 
开发者ID:wlixcc,项目名称:pythonORM,代码行数:11,代码来源:ormTest.py

示例10: test

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def test():
    yield from orm.create_pool(loop, user='root', password='czh', db='weppy')
    user = User(name="admin", password='123', is_admin=True)
    yield from user.save()
    yield from orm.destory_pool() 
开发者ID:seniorcandy,项目名称:Weppy,代码行数:7,代码来源:orm_test.py

示例11: init

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def init(loop):
	# await orm.create_pool(loop=loop, host='127.0.0.1', port=3306, user='root', password='1qazxsw2', db='awesome')
	await orm.create_pool(loop=loop, **configs.db)
	app = web.Application(loop=loop, middlewares=[
		logger_factory, auth_factory, response_factory
	])
	init_jinja2(app, filters=dict(datetime=datetime_filter))
	add_routes(app, 'handlers')
	add_static(app)
	srv = await loop.create_server(app.make_handler(), '127.0.0.1', 9000)
	logging.info('server started at http://127.0.0.1:9000...')
	return srv 
开发者ID:TsangTen,项目名称:awesome-webapp,代码行数:14,代码来源:app.py

示例12: init

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def init(loop):
    '''
    ???web???.
    '''
    await orm.create_pool(loop = loop, **configs.db)
    app = web.Application(loop = loop, middlewares = [
        logger_factory, auth_factory, response_factory
    ])
    # filters??????jinja2?????
    init_jinja2(app, filters = dict(datetime = datetime_filter))
    add_routes(app, 'handlers')
    add_static(app)
    srv = await loop.create_server(app.make_handler(), '0.0.0.0', 9000)
    logging.info('server start at http://127.0.0.1:9000...')
    return srv 
开发者ID:chenpengcong,项目名称:python3-webapp,代码行数:17,代码来源:app.py

示例13: test

# 需要导入模块: import orm [as 别名]
# 或者: from orm import create_pool [as 别名]
def test(loop):
    '''
    Test orm framewoek.
    '''
    yield from orm.create_pool(loop=loop,user = 'www-data', password = 'www-data', db = 'awesome')

    user = User(id='ni',name = 'Coco Shi',email = '[email protected]', passwd = '102033', image = 'blank')

    yield from user.save() 
开发者ID:chenpengcong,项目名称:python3-webapp,代码行数:11,代码来源:test.py


注:本文中的orm.create_pool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。