Beispiel #1
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config["APP_ABSPATH"] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    app = superdesk_app(config)

    app.config["BABEL_TRANSLATION_DIRECTORIES"] = (
        app.config.get("BABEL_TRANSLATION_DIRECTORIES") + ";" +
        os.path.join(SUPERDESK_PATH, "server/translations"))

    if os.environ.get("APM_SERVER_URL") and os.environ.get("APM_SECRET_TOKEN"):
        app.config["ELASTIC_APM"] = {
            "DEBUG": app.debug,
            "TRANSACTIONS_IGNORE_PATTERNS": ["^OPTIONS "],
            "SERVICE_NAME": app.config.get("APM_SERVICE_NAME")
            or "superdesk-cp",
            "SERVER_URL": os.environ["APM_SERVER_URL"],
            "SECRET_TOKEN": os.environ["APM_SECRET_TOKEN"],
        }

        ElasticAPM(app)

    return app
Beispiel #2
0
def get_app(config=None, init_elastic=False):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    media_storage = None
    if config['AMAZON_CONTAINER_NAME']:
        from superdesk.storage.amazon.amazon_media_storage import AmazonMediaStorage
        media_storage = AmazonMediaStorage

    config['DOMAIN'] = {}

    app = superdesk_app(config, media_storage, init_elastic=init_elastic)
    configure_logging(config['LOG_CONFIG_FILE'])
    return app
Beispiel #3
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config["APP_ABSPATH"] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    media_storage = None
    if config["AMAZON_CONTAINER_NAME"]:
        from superdesk.storage.amazon.amazon_media_storage import AmazonMediaStorage

        media_storage = AmazonMediaStorage

    config["DOMAIN"] = {}

    app = superdesk_app(config, media_storage)
    return app
Beispiel #4
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    app = superdesk_app(config)

    app.config['BABEL_TRANSLATION_DIRECTORIES'] = app.config.get('BABEL_TRANSLATION_DIRECTORIES') + \
        ';' + os.path.join(SUPERDESK_PATH, 'server/translations')

    if os.environ.get('APM_SERVER_URL') and os.environ.get('APM_SECRET_TOKEN'):
        app.config['ELASTIC_APM'] = {
            'DEBUG': app.debug,
            'TRANSACTIONS_IGNORE_PATTERNS': ['^OPTIONS '],
            'SERVICE_NAME': app.config.get('APM_SERVICE_NAME')
            or 'superdesk-cp',
            'SERVER_URL': os.environ['APM_SERVER_URL'],
            'SECRET_TOKEN': os.environ['APM_SECRET_TOKEN'],
        }

        ElasticAPM(app)

    return app
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    media_storage = None
    if config['AMAZON_CONTAINER_NAME']:
        from superdesk.storage.amazon.amazon_media_storage import AmazonMediaStorage
        media_storage = AmazonMediaStorage

    config['DOMAIN'] = {}

    app = superdesk_app(config, media_storage)
    configure_logging(config['LOG_CONFIG_FILE'])
    return app
Beispiel #6
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    media_storage = None
    if config['AMAZON_CONTAINER_NAME']:
        from superdesk.storage.amazon.amazon_media_storage import AmazonMediaStorage
        media_storage = AmazonMediaStorage

    config['DOMAIN'] = {}

    # Create superdesk app instance.
    app = superdesk_app(config, media_storage, init_elastic=True)

    # Add custom jinja2 template loader.
    custom_loader = jinja2.ChoiceLoader(
        [jinja2.FileSystemLoader('superdesk/templates'), app.jinja_loader])
    app.jinja_loader = custom_loader

    # Caching.
    app.cache = Cache(app, config={'CACHE_TYPE': 'simple'})
    app.blog_cache = BlogCache(cache=app.cache)

    # Amazon S3 support.
    s3 = flask_s3.FlaskS3()
    s3.init_app(app)

    # Embed feature.
    app.register_blueprint(embed_blueprint)

    # Embed bloglist.
    app.register_blueprint(bloglist_assets_blueprint)
    app.register_blueprint(bloglist_blueprint)

    # Analytics.
    app.register_blueprint(analytics_blueprint)

    # Syndication feature.
    app.register_blueprint(producers_blueprint)
    app.register_blueprint(consumers_blueprint)
    app.register_blueprint(syndication_blueprint)
    app.register_blueprint(syndication_blogs_blueprint)

    # Marketplace.
    app.register_blueprint(marketers_blueprint)

    return app
Beispiel #7
0
def get_app(config=None, init_elastic=False):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    config = config or {'APP_ABSPATH': os.path.abspath(os.path.dirname(__file__))}

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    return superdesk_app(config)
Beispiel #8
0
def get_app(config=None):
    if config is None:
        config = {}

    config['APP_ABSPATH'] = path.abspath(path.dirname(__file__))
    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    config['DOMAIN'] = {}

    app = superdesk_app(config)
    configure_logging(config['LOG_CONFIG_FILE'])
    return app
Beispiel #9
0
def get_app(config=None, init_elastic=False):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    app = superdesk_app(config, init_elastic=init_elastic)
    return app
Beispiel #10
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    app = superdesk_app(config)
    return app
Beispiel #11
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    config['DOMAIN'] = {}

    app = superdesk_app(config)
    configure_logging(config['LOG_CONFIG_FILE'])
    return app
Beispiel #12
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    media_storage = None
    if config['AMAZON_CONTAINER_NAME']:
        from superdesk.storage.amazon.amazon_media_storage import AmazonMediaStorage
        media_storage = AmazonMediaStorage

    config['DOMAIN'] = {}

    app = superdesk_app(config, media_storage)

    custom_loader = jinja2.ChoiceLoader([
        jinja2.FileSystemLoader('superdesk/templates'),
        app.jinja_loader
    ])
    app.jinja_loader = custom_loader

    # cache
    app.cache = Cache(app, config={'CACHE_TYPE': 'simple'})
    app.blog_cache = BlogCache(cache=app.cache)
    # s3
    s3 = flask_s3.FlaskS3()
    s3.init_app(app)
    # embed feature
    app.register_blueprint(embed_blueprint)
    return app
Beispiel #13
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    media_storage = None
    if config['AMAZON_CONTAINER_NAME']:
        from superdesk.storage.amazon.amazon_media_storage import AmazonMediaStorage
        media_storage = AmazonMediaStorage

    config['DOMAIN'] = {}

    app = superdesk_app(config, media_storage)

    custom_loader = jinja2.ChoiceLoader(
        [jinja2.FileSystemLoader('superdesk/templates'), app.jinja_loader])
    app.jinja_loader = custom_loader

    # cache
    app.cache = Cache(app, config={'CACHE_TYPE': 'simple'})
    app.blog_cache = BlogCache(cache=app.cache)
    # s3
    s3 = flask_s3.FlaskS3()
    s3.init_app(app)
    # embed feature
    app.register_blueprint(embed_blueprint)
    return app
Beispiel #14
0
def get_app(config=None):
    """App factory.

    :param config: configuration that can override config from `settings.py`
    :return: a new SuperdeskEve app instance
    """
    if config is None:
        config = {}

    config['APP_ABSPATH'] = os.path.abspath(os.path.dirname(__file__))

    for key in dir(settings):
        if key.isupper():
            config.setdefault(key, getattr(settings, key))

    media_storage = None
    if config.get('AMAZON_CONTAINER_NAME'):
        from superdesk.storage.amazon_media_storage import AmazonMediaStorage
        media_storage = AmazonMediaStorage

    config['DOMAIN'] = {}

    # Create superdesk app instance.
    app = superdesk_app(config, media_storage)

    # Add custom jinja2 template loader.
    custom_loader = jinja2.ChoiceLoader(
        [jinja2.FileSystemLoader('superdesk/templates'), app.jinja_loader])
    app.jinja_loader = custom_loader

    # Caching. By default 'simple' cache will be used
    cache_config = {'CACHE_TYPE': settings.LIVEBLOG_CACHE_TYPE}
    if cache_config['CACHE_TYPE'] == 'redis':
        cache_config.update({
            'CACHE_REDIS_URL': settings.LIVEBLOG_CACHE_REDIS_URL,
            'CACHE_KEY_PREFIX': instance_prefix('_lb-cache_')
        })

    app.cache = Cache(app, config=cache_config)
    app.blog_cache = BlogCache(cache=app.cache)

    # Amazon S3 support.
    s3 = flask_s3.FlaskS3()
    s3.init_app(app)

    # Embed feature.
    app.register_blueprint(embed_blueprint)

    # Embed bloglist.
    app.register_blueprint(bloglist_assets_blueprint)
    app.register_blueprint(bloglist_blueprint)

    # Analytics.
    app.register_blueprint(analytics_blueprint)

    # Advertisements.
    app.register_blueprint(advertisements_blueprint)

    # Syndication feature.
    app.register_blueprint(producers_blueprint)
    app.register_blueprint(consumers_blueprint)
    app.register_blueprint(syndication_blueprint)
    app.register_blueprint(syndication_blogs_blueprint)

    # Marketplace.
    app.register_blueprint(marketers_blueprint)

    # Drag and drop
    app.register_blueprint(drag_and_drop_blueprint)

    # New posts endpoint
    app.register_blueprint(blog_posts_blueprint)

    # Video upload endpoint
    app.register_blueprint(video_upload_blueprint)

    return app
Beispiel #15
0
def get_app(config=None):
    if config is None:
        config = {}
    app = superdesk_app(config, config_object='settings')
    return app
Beispiel #16
0
def get_app(config=None):
    if config is None:
        config = {}
    app = superdesk_app(config, config_object='settings')
    return app