コード例 #1
0
ファイル: wsgi.py プロジェクト: hjalves/ines
    def start_applications(self, debug=False):
        settings = get_appsettings(self.config_path)
        not_found_application = settings.local_conf.pop(
            'not_found_application',
            settings.global_conf.get('not_found_application'))
        if not_found_application:
            not_found_application = loadapp(
                not_found_application,
                global_conf=settings.global_conf)
        else:
            not_found_application = not_found_api_application(
                settings.global_conf, **settings.local_conf)
        self.not_found_application = not_found_application

        self.validate_config_seconds = maybe_integer(
            settings.local_conf.pop('validate_config_seconds', None))

        for path, app_name in settings.local_conf.items():
            path = parse_path_expression(path)
            self[path] = get_app(self.config_path, app_name)

            if debug:
                print (
                    'Application %s reloaded on pid %s'
                    % (app_name, getpid()))
コード例 #2
0
def urlmap_factory(loader, global_conf, **local_conf):
    """
    Hook for urlmap and gunicorn custom worker. Since the Gunicorn custom app forces the
    apps to have a start and stop method.
    """
    urlmap = URLMapGunicornHook(not_found_app=None)
    for path, app_name in local_conf.items():
        path = parse_path_expression(path)
        app = loader.get_app(app_name, global_conf=global_conf)
        urlmap[path] = app
    return urlmap
コード例 #3
0
def hub_factory(loader, global_conf, **local_conf):
    if 'not_found_app' in local_conf:
        not_found_app = local_conf.pop('not_found_app')
    else:
        not_found_app = global_conf.get('not_found_app')
    if not_found_app:
        not_found_app = loader.get_app(not_found_app, global_conf=global_conf)
    urlmap = RemoteHub(not_found_app=not_found_app)
    for path, app_name in local_conf.items():
        path = parse_path_expression(path)
        app = loader.get_app(app_name, global_conf=global_conf)
        urlmap[path] = app
    return urlmap
コード例 #4
0
ファイル: urlmap.py プロジェクト: TerryIron/paster
def urlmap_factory(loader, global_conf, **local_conf):
    if 'not_found_app' in local_conf:
        not_found_app = local_conf.pop('not_found_app')
    else:
        not_found_app = global_conf.get('not_found_app')
    if not_found_app:
        not_found_app = loader.get_app(not_found_app, global_conf=global_conf)
    _map = URLMap(not_found_app=not_found_app)
    for path, app_name in local_conf.items():
        path = parse_path_expression(path)
        _global_conf = copy.copy(global_conf)
        if URL_PATH not in _global_conf:
            _global_conf[URL_PATH] = '[{0}]'.format(app_name)
        _global_conf[URL_PATH] += path
        app, hooks = loader.get_app(app_name, global_conf=_global_conf)
        _map[path] = app
        for hook in hooks:
            _map.add_hook(hook)
    return _map
コード例 #5
0
    def start_applications(self, debug=False):
        settings = get_appsettings(self.config_path)
        not_found_application = settings.local_conf.pop(
            'not_found_application',
            settings.global_conf.get('not_found_application'))
        if not_found_application:
            not_found_application = loadapp(not_found_application,
                                            global_conf=settings.global_conf)
        else:
            not_found_application = not_found_api_application(
                settings.global_conf, **settings.local_conf)
        self.not_found_application = not_found_application

        self.validate_config_seconds = maybe_integer(
            settings.local_conf.pop('validate_config_seconds', None))

        for path, app_name in settings.local_conf.items():
            path = parse_path_expression(path)
            self[path] = get_app(self.config_path, app_name)

            if debug:
                print('Application %s reloaded on pid %s' %
                      (app_name, getpid()))