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


Python Brubeck.run方法代码示例

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


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

示例1: WSGIConnection

# 需要导入模块: from brubeck.request_handling import Brubeck [as 别名]
# 或者: from brubeck.request_handling.Brubeck import run [as 别名]
    """
    Flush the database occasionally.
    """
    while True:
        chat.flush(db_conn)
        coro_lib.sleep(TIMEOUT)


#
# RUN BRUBECK RUN
#
config = {
    "msg_conn": WSGIConnection(port=PORT),
    "handler_tuples": [
        (r"^/$", IndexHandler),
        (r"^/rooms$", RoomsHandler),
        (r"^/buffer$", BufferHandler),
        (r"^/(?P<room>[^/]+)/?$", RoomHandler),
        (r"^/(?P<room>[^/]+)/users$", UsersHandler),
        (r"^/(?P<room>[^/]+)/messages$", MessagesHandler),
    ],
    "cookie_secret": COOKIE_SECRET,
    "db_conn": redis.StrictRedis(db=DB),
    "template_loader": load_mustache_env(TEMPLATES_DIR),
}

onionchat = Brubeck(**config)
toilet = onionchat.pool.spawn(drain, onionchat.db_conn)
onionchat.run()
toilet.kill()
开发者ID:Gazegirl,项目名称:OnionChat,代码行数:32,代码来源:server.py

示例2: init_db_conn

# 需要导入模块: from brubeck.request_handling import Brubeck [as 别名]
# 或者: from brubeck.request_handling.Brubeck import run [as 别名]
###

# Instantiate database connection
db_conn = init_db_conn()

# Routing config
handler_tuples = [
    (r'^/login', AccountLoginHandler),
    (r'^/logout', AccountLogoutHandler),
    (r'^/create', AccountCreateHandler),
    (r'^/add_item', ListAddHandler),
    (r'^/api', APIListDisplayHandler),
    (r'^/$', ListDisplayHandler),
]

# Application config
config = {
    'msg_conn': Mongrel2Connection('tcp://127.0.0.1:9999','tcp://127.0.0.1:9998'),
    'handler_tuples': handler_tuples,
    'template_loader': load_jinja2_env('./templates'),
    'db_conn': db_conn,
    'login_url': '/login',
    'cookie_secret': 'OMGSOOOOOSECRET',
    'log_level': logging.DEBUG,
}


# Instantiate app instance
app = Brubeck(**config)
app.run()
开发者ID:j2labs,项目名称:listsurf,代码行数:32,代码来源:listsurf.py

示例3: WSGIConnection

# 需要导入模块: from brubeck.request_handling import Brubeck [as 别名]
# 或者: from brubeck.request_handling.Brubeck import run [as 别名]
                self.set_status(204)
            else:
                self.set_status(400, 'Could not submit move')
        else:
            self.set_status(400, 'You are not in this game')

        return self.render()

###
#
# BRUBECK RUNNER
#
###
config = {
    'msg_conn': WSGIConnection(port=PORT),
    'handler_tuples': [(r'^/$', GameListHandler),
                       (r'^/create$', CreateGameHandler),
                       (r'^/(?P<game_name>[^/]+)$', ForwardToGameHandler),
                       (r'^/(?P<game_name>[^/]+)/$', GameHandler),
                       (r'^/(?P<game_name>[^/]+)/join$', JoinHandler),
                       (r'^/(?P<game_name>[^/]+)/start$', StartHandler),
                       (r'^/(?P<game_name>[^/]+)/move$', MoveHandler),
                       (r'^/(?P<game_name>[^/]+)/chat$', ChatHandler)],
    'cookie_secret': COOKIE_SECRET,
    'db_conn': redis.StrictRedis(db=DB),
    'template_loader': load_mustache_env('./templates')
}

opengold = Brubeck(**config)
opengold.run()
开发者ID:talos,项目名称:opengold,代码行数:32,代码来源:server.py

示例4: post

# 需要导入模块: from brubeck.request_handling import Brubeck [as 别名]
# 或者: from brubeck.request_handling.Brubeck import run [as 别名]
    it is ready.
    """

    def post(self):
        json_request = self.message.body
        try:
            # connect to backend
            sock = CONTEXT.socket(zmq.REQ)
            sock.connect(BACKEND_URI)
            #request_obj = ast.literal_eval(json_request)
            #sock.send_json(request_obj)
            sock.send(json_request)

            resp = sock.recv()
            self.headers['Content-Type'] = 'application/json'

            self.set_body(resp)
        except Exception as e:
            self.set_status(400,
                            status_msg="Invalid JSON Request: '%s', error '%s'"
                            % (json_request, e))

        return self.render()

config.update({
    'mongrel2_pair': (config[RECV_SPEC], config[SEND_SPEC]),
    'handler_tuples': [(r'^/request$', RequestHandler)] })

openscrape = Brubeck(**config)
openscrape.run()
开发者ID:pombredanne,项目名称:openscrape,代码行数:32,代码来源:proxy.py

示例5: Brubeck

# 需要导入模块: from brubeck.request_handling import Brubeck [as 别名]
# 或者: from brubeck.request_handling.Brubeck import run [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from brubeck.request_handling import Brubeck
from config import config

le_app = Brubeck(**config)

if __name__ == '__main__':
  le_app.run()
开发者ID:faruken,项目名称:brubeck-twidder,代码行数:12,代码来源:main.py


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