Beispiel #1
0
def _make_app(
    app_config=TEST_CONFIG,
    _db_rw=None,
    _db_ro=None,
    _http_session=None,
    _geoip_db=None,
    _raven_client=None,
    _redis_client=None,
    _stats_client=None,
    _country_searcher=None,
    _position_searcher=None,
):
    wsgiapp = main(
        app_config,
        _db_rw=_db_rw,
        _db_ro=_db_ro,
        _geoip_db=_geoip_db,
        _http_session=_http_session,
        _raven_client=_raven_client,
        _redis_client=_redis_client,
        _stats_client=_stats_client,
        _country_searcher=_country_searcher,
        _position_searcher=_position_searcher,
    )
    return TestApp(wsgiapp)
Beispiel #2
0
def _make_app(app_config=TEST_CONFIG,
              _db_rw=None, _db_ro=None, _geoip_db=None,
              _raven_client=None, _redis_client=None, _stats_client=None):
    wsgiapp = main(
        {},
        app_config,
        _db_rw=_db_rw,
        _db_ro=_db_ro,
        _geoip_db=_geoip_db,
        _raven_client=_raven_client,
        _redis_client=_redis_client,
        _stats_client=_stats_client)
    return TestApp(wsgiapp)
Beispiel #3
0
def _make_app(_db=None, _http_session=None, _geoip_db=None,
              _raven_client=None, _redis_client=None, _stats_client=None,
              _position_searcher=None, _region_searcher=None):
    wsgiapp = main(
        _db=_db,
        _geoip_db=_geoip_db,
        _http_session=_http_session,
        _raven_client=_raven_client,
        _redis_client=_redis_client,
        _stats_client=_stats_client,
        _position_searcher=_position_searcher,
        _region_searcher=_region_searcher,
    )
    return webtest.TestApp(wsgiapp)
Beispiel #4
0
def wsgi_app(environ, start_response):  # pragma: no cover
    # Actual WSGI application endpoint, used on the command line via:
    # bin/gunicorn -c ichnaea.webapp.settings ichnaea.webapp.app:wsgi_app
    global _APP

    if _APP is None:
        conf = read_config()
        # Signal this call was made as part of app initialization
        _APP = main({}, conf, init=True)
        if environ is None and start_response is None:
            # Called as part of gunicorn's post_worker_init
            return _APP

    return _APP(environ, start_response)
Beispiel #5
0
def global_app(db, geoip_db, http_session, map_config,
               raven_client, redis_client, stats_client,
               position_searcher, region_searcher):
    wsgiapp = main(
        _db=db,
        _geoip_db=geoip_db,
        _http_session=http_session,
        _raven_client=raven_client,
        _redis_client=redis_client,
        _stats_client=stats_client,
        _position_searcher=position_searcher,
        _region_searcher=region_searcher,
    )
    app = webtest.TestApp(wsgiapp)
    yield app
    shutdown_app(app.app)
Beispiel #6
0
def wsgi_app(environ, start_response):  # pragma: no cover
    """
    Actual WSGI application endpoint, used on the command line via:

    .. code-block:: bash

        bin/gunicorn -c ichnaea.webapp.settings ichnaea.webapp.app:wsgi_app

    At startup reads the app config and calls
    :func:`ichnaea.webapp.config.main` once to setup the web app stored
    in the :data:`ichnaea.webapp.app._APP` global.
    """
    global _APP

    if _APP is None:
        conf = read_config()
        _APP = main(conf, ping_connections=True)
        if environ is None and start_response is None:
            # Called as part of gunicorn's post_worker_init
            return _APP

    return _APP(environ, start_response)