问题:
path = "auth.my_auth.AUTH" # 根据path实例化AUTH类
解决:
path = "auth.my_auth.AUTH" import importlib model_path, class_name = path.rsplit(".", 1) model = importlib.import_module(model_path) # 根据"auth.my_auth"导入my_auth模块 obj = getattr(model, class_name)() # 反射并实例化