def get_current_app(request): try: return request.current_app except (VariableDoesNotExist, AttributeError): pass return None