def application(environ, start_response): """WSGI application factory.""" for key, value in environ.items(): if type(value) is str: os.environ[key] = value app = create_api_web_app() return app(environ, start_response)
def setUp(self): """Instantiate and configure an API app.""" jwt_secret = 'foosecret' os.environ['JWT_SECRET'] = jwt_secret self.app = factory.create_api_web_app() self.app.config['JWT_SECRET'] = jwt_secret self.client = self.app.test_client() with open(self.SCHEMA_PATH) as f: self.schema = json.load(f)
def application(environ, start_response): """WSGI application factory.""" for key, value in environ.items(): # In some deployment scenarios (e.g. uWSGI on k8s), uWSGI will pass in # the hostname as part of the request environ. This will usually just # be a container ID, which is not helpful for things like building # URLs. We want to keep ``SERVER_NAME`` explicitly configured, either # in config.py or via an os.environ var loaded by config.py. if key == "SERVER_NAME": continue if type(value) is str: os.environ[key] = value global __flask_app__ if __flask_app__ is None: __flask_app__ = create_api_web_app() return __flask_app__(environ, start_response)
"""Provides application for development purposes.""" from search.factory import create_api_web_app app = create_api_web_app()
"""Web Server Gateway Interface entry-point.""" from search.factory import create_api_web_app import os __flask_app__ = create_api_web_app() def application(environ, start_response): """WSGI application factory.""" for key, value in environ.items(): # In some deployment scenarios (e.g. uWSGI on k8s), uWSGI will pass in # the hostname as part of the request environ. This will usually just # be a container ID, which is not helpful for things like building # URLs. We want to keep ``SERVER_NAME`` explicitly configured, either # in config.py or via an os.environ var loaded by config.py. if key == 'SERVER_NAME': continue os.environ[key] = str(value) __flask_app__.config[key] = str(value) return __flask_app__(environ, start_response)