handlers.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:nbpuller 作者: data-8 项目源码 文件源码
def setup_handlers(web_app):
    env_name = 'production'
    config = config_for_env(env_name, web_app.settings['base_url'])
    define('config', config)

    settings = dict(
        debug=True,
        serve_traceback=True,
        compiled_template_cache=False,
        template_path=os.path.join(os.path.dirname(__file__), 'static/'),
        static_path=os.path.join(os.path.dirname(__file__), 'static/'),

        # Ensure static urls are prefixed with the base url too
        static_url_prefix=config['URL'] + 'static/',
    )
    web_app.settings.update(settings)

    socket_url = url_path_join(config['URL'], r'socket/(\S+)')
    host_pattern = '.*'
    route_pattern = url_path_join(config['URL'], '/interact')
    web_app.add_handlers(host_pattern, [
        (route_pattern, LandingHandler),
        (route_pattern + '/', LandingHandler),
        (socket_url, RequestHandler)
    ])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号