Exemple #1
0
def make_app(config):
    """Return a DXR application which uses ``config`` as its configuration.

    Also set up the static and template folder.

    """
    app = Flask('dxr')
    app.dxr_config = config
    app.register_blueprint(dxr_blueprint, url_prefix=config.www_root)

    # Log to Apache's error log in production:
    app.logger.addHandler(StreamHandler(stderr))

    # Make an ES connection pool shared among all threads:
    app.es = ElasticSearch(config.es_hosts)

    return app
Exemple #2
0
def make_app(config):
    """Return a DXR application which uses ``config`` as its configuration.

    Also set up the static and template folder.

    """
    app = Flask('dxr')
    app.dxr_config = config
    app.register_blueprint(dxr_blueprint, url_prefix=config.www_root)
    HashedStatics(app=app)

    # The url_prefix we pass when registering the blueprint is not stored
    # anywhere. This saves gymnastics in our custom URL builders to get it back:
    app.dxr_www_root = config.www_root

    # Log to Apache's error log in production:
    app.logger.addHandler(StreamHandler(stderr))

    # Make an ES connection pool shared among all threads:
    app.es = ElasticSearch(config.es_hosts)

    return app