# utils/config_loader.py import json import os class ConfigLoader: @staticmethod def load_config(file_path): """从JSON文件加载配置""" if not os.path.exists(file_path): raise FileNotFoundError(f"配置文件不存在: {file_path}") with open(file_path, 'r', encoding='utf-8') as f: return json.load(f) # 在需要使用配置的地方,可以这样调用 if __name__ == "__main__": config_path = os.path.join(os.path.dirname(__file__), '..', 'conf', 'appConfig.json') config = ConfigLoader.load_config(config_path) print(config)