@contextmanager def get_app_context(conf=None): """get an app context! we will receive the name of the application and then try to build out the applicaton and return it. the important thing with this function is that we will return the application context not the actual application object. this is usefull for modules and functions that need the application context to be able to do what they would need to do. the config is the name of the config class we want to use to create the app with. :param conf: name of the config class :return: a flask application context """ if not conf: conf = 'development' try: app = create_app(cm.get(conf)) with app.app_context() as ctx: yield ctx finally: pass