def douglas_app_factory(global_config, **local_config):
    """App factory for paste.

    :returns: WSGI application

    """
    conf = global_config.copy()
    conf.update(local_config)
    conf.update(dict(local_config=local_config, global_config=global_config))

    if "configpydir" in conf:
        sys.path.insert(0, conf["configpydir"])

    return DouglasWSGIApp(configini=conf)