"""Application. The API application is a `flask` application. It provides simple features such as registering a url for a specific handlers. """ from flask import Flask from flask_caching import Cache from owslogger import flask_logger from owsrequest import flask_request from pricing import config app = Flask(config.SERVICE_NAME) flask_logger.setup( app, config.ENVIRONMENT, config.LOGGER_NAME, config.LOGGER_LEVEL, config.SERVICE_NAME, config.SERVICE_VERSION, exclude_paths=[config.HEALTH_CHECK]) try: import uwsgi # noqa uwsgiRunning = True except ImportError: uwsgiRunning = False flask_request.setup( app, config.ENVIRONMENT, uwsgi_cache_enabled=uwsgiRunning, add_request_context=True) if config.ENVIRONMENT in [config.QA_ENVIRONMENT, config.PROD_ENVIRONMENT]: cache = Cache(app, config={'CACHE_TYPE': 'simple'}) else: cache = Cache(app, config={'CACHE_TYPE': 'null'})