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


Python web.Application类代码示例

本文整理汇总了Python中aiohttp.web.Application的典型用法代码示例。如果您正苦于以下问题:Python Application类的具体用法?Python Application怎么用?Python Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init

    async def init(loop):
        app = Application(loop=loop)
        app.router.add_route('POST', '/query', handle)

        handler = app.make_handler()
        srv = await loop.create_server(handler, conf['http_hostname'], conf['http_port'])
        return srv, handler
开发者ID:petrjanda,项目名称:pysk,代码行数:7,代码来源:client.py

示例2: start_server

 def start_server(loop):
     app = Application(loop=loop)
     app.router.add_route(*handler.route)
     routes = app.router.routes()._urls
     assert len(routes), routes
     srv = yield from loop.create_server(app.make_handler(), "localhost", 9000)
     return srv
开发者ID:andrewyoung1991,项目名称:django-redis-pubsub,代码行数:7,代码来源:test_testapp.py

示例3: init

async def init(loop):
    app = Application(loop=loop)
    app['sockets'] = {}
    print("Connecting to DB...")
    app['db'] = await db.create_db()
    print("Connected.")

    # HTML endpoint
    app.router.add_route('GET', '/', api.index.index)

    # Admin dashboard app management endpoints
    app.router.add_route('GET', '/apps', api.apps.get_all_apps)
    app.router.add_route('GET', '/apps/{app_id}', api.apps.get_app)
    app.router.add_route('POST', '/apps', api.apps.create_app)
    app.router.add_route('DELETE', '/apps/{app_id}', api.apps.delete_app)

    # Http lib endpoints
    # app.router.add_route('GET', '/apps/{app_id}/channels', '')
    # app.router.add_route('GET', '/apps/{app_id}/channels/{channel_name}', '')
    # app.router.add_route('GET', '/apps/{app_id}/channels/{channel_name}/users', '')
    # app.router.add_route('POST', '/apps/{app_id}/events', '')

    # Websocket and message endpoints
    app.router.add_route('GET', '/ws/{channel}', api.message.ws_handler)
    app.router.add_route('POST', '/apps/{app_id}/events', api.message.msg_handler)

    root = os.path.dirname(os.path.abspath(__file__))
    here = root + '/client/dist/assets'
    app.router.add_static('/assets', here)

    logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
    handler = app.make_handler(access_log=logging.getLogger('clang.access'))
    srv = await loop.create_server(handler, '127.0.0.1', 8040)
    print("Server started at http://127.0.0.1:8040")
    return app, srv, handler
开发者ID:Shellu,项目名称:clang,代码行数:35,代码来源:clang.py

示例4: init

def init(loop):
    app = Application(loop=loop)
    app.router.add_route('GET', '/', simple)

    handler = app.make_handler()
    srv = yield from loop.create_server(handler, '127.0.0.1', 8080)
    print("Server started at http://127.0.0.1:8080")
    return srv, handler
开发者ID:asvetlov,项目名称:europython2015,代码行数:8,代码来源:aiohttp_server.py

示例5: init

def init(loop):
    app = Application(loop=loop, middlewares=[middleware_factory])
    app.router.add_route("GET", "/", handler)

    requests_handler = app.make_handler()
    srv = yield from loop.create_server(requests_handler, "127.0.0.1", 8080)
    print("Server started at http://127.0.0.1:8080")
    return srv, requests_handler
开发者ID:cclauss,项目名称:aiohttp,代码行数:8,代码来源:web_rewrite_headers_middleware.py

示例6: init

async def init(loop):
    app = Application(loop=loop)
    app.router.add_route('GET', '/', handle)

    srv = await loop.create_server(app.make_handler(),
                                   '127.0.0.1', 1337)
    print('Server started at http://127.0.0.1:1337')
    return srv
开发者ID:alexeyraspopov,项目名称:python-hot-swap,代码行数:8,代码来源:__main__.py

示例7: init

def init(loop):
    app = Application(loop=loop)
    app["sockets"] = []
    app.router.add_route("GET", "/", wshandler)

    handler = app.make_handler()
    srv = yield from loop.create_server(handler, "127.0.0.1", 8080)
    print("Server started at http://127.0.0.1:8080")
    return app, srv, handler
开发者ID:graingert,项目名称:aiohttp,代码行数:9,代码来源:web_ws.py

示例8: webserver

def webserver(loop):
    app = Application(loop=loop)

    app.router.add_route('GET', '/eventsource/', eventsource)

    handler = app.make_handler()
    srv = yield from loop.create_server(handler, '127.0.0.1', args.eventsource)
    logging.info("Eventsource started at http://127.0.0.1:{}".format(args.eventsource))
    return srv, handler
开发者ID:MartijnBraam,项目名称:drush-queued,代码行数:9,代码来源:__main__.py

示例9: init

def init(loop):
    app = Application(loop=loop)
    wsgi_handler = WSGIHandler(django_app)

    app.router.add_route('*', '/ws/myjrpc', MyJsonRpc)
    app.router.add_route('*', '/ws/mydajrpc', MyDjangoAuthJsonRpc)
    app.router.add_route('*', '/{path_info:.*}', wsgi_handler.handle_request)

    yield from loop.create_server(app.make_handler(), '', 8080)
开发者ID:basti2342,项目名称:aiohttp-json-rpc,代码行数:9,代码来源:server.py

示例10: init

def init(loop):
    app = Application(loop=loop)
    app['sockets'] = []
    app.router.add_route('GET', '/wfb', wshandler)

    handler = app.make_handler()
    srv = yield from loop.create_server(handler, '127.0.0.1', 8001)
    print("Server started at http://127.0.0.1:8080")
    return app, srv, handler
开发者ID:bossjones,项目名称:etc-python,代码行数:9,代码来源:web_ws.py

示例11: init

def init(loop):
    app = Application(middlewares=[session_middleware(
        EncryptedCookieStorage(SECRET_KEY))])
    setup_jinja(app, loader=FileSystemLoader(TEMPLATE_DIR))
    for route in routes:
        app.router.add_route(route['method'], route['url'], route['handler'], **route['kwargs_'])
    srv = yield from loop.create_server(
        app.make_handler(), '0.0.0.0', 8080)
    return srv
开发者ID:YGeeneY,项目名称:tic_tac_toe,代码行数:9,代码来源:server.py

示例12: init

async def init(loop):
    app = Application(loop=loop)
    app['connections'] = {}
    app.router.add_route('GET', '/', ws_handler)

    handler = app.make_handler()
    srv = await loop.create_server(handler, '127.0.0.1', '8000')
    print("Server running on 127.0.0.1:8000")
    return app, srv, handler
开发者ID:tao12345666333,项目名称:Talk-Is-Cheap,代码行数:9,代码来源:ws.py

示例13: main

def main(loop):
    app = Application(loop=loop)
    app.router.add_route('GET', '/', user_info)
    app.router.add_route('GET', '/group_id', user_group_id)

    handler = app.make_handler()
    srv = yield from loop.create_server(handler, '127.0.0.1', 8888)
    print("Server started at http://127.0.0.1:8888")
    return srv, handler
开发者ID:JSFansw,项目名称:wechatpy,代码行数:9,代码来源:app.py

示例14: init

def init(loop):
    global handler
    app = Application(loop=loop)
    app.router.add_route('GET', '/', handle_get)
    app.router.add_route('POST', '/IPN', handle_ipn)

    handler = app.make_handler()
    srv = yield from loop.create_server(handler, '0.0.0.0', 8080)
    logging.info("IPN Server started at http://0.0.0.0:8080")
开发者ID:Avatarchik,项目名称:netwrok-server,代码行数:9,代码来源:ipn.py

示例15: init

def init(loop, args):
    app = Application(loop=loop)
    app['sockets'] = []
    app.router.add_route('GET', '/', wsHandler)

    handler = app.make_handler()
    srv = yield from loop.create_server(handler, args.host, args.port)
    print("Server started at http://{}:{}".format(args.host, args.port))
    return app, srv, handler
开发者ID:cphyc,项目名称:andremote,代码行数:9,代码来源:web_ws.py


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