diff --git a/common/config.py b/common/config.py index 8ad7991..b1a417a 100644 --- a/common/config.py +++ b/common/config.py @@ -22,6 +22,8 @@ logger = log('config_manager') # 创建线程本地存储对象 local_data = threading.local() +if not os.path.exists('data'): + os.mkdir('data') def get_data_connection(): # 检查线程本地存储对象是否存在连接对象,如果不存在则创建一个新的连接对象 @@ -643,7 +645,7 @@ def initConfig(): variable.log_length_limit = read_config('common.log_length_limit') variable.debug_mode = read_config('common.debug_mode') logger.debug("配置文件加载成功") - conn = sqlite3.connect('cache.db') + conn = sqlite3.connect('./data/cache.db') # 创建一个游标对象 cursor = conn.cursor() @@ -657,7 +659,7 @@ data TEXT NOT NULL)''') conn.close() - conn2 = sqlite3.connect('data.db') + conn2 = sqlite3.connect('./data/data.db') # 创建一个游标对象 cursor2 = conn2.cursor() diff --git a/common/variable.py b/common/variable.py index 0b9c955..4c02183 100644 --- a/common/variable.py +++ b/common/variable.py @@ -12,7 +12,7 @@ import ujson as _json def _read_config_file(): try: - with open("./config.json", "r", encoding = "utf-8") as f: + with open("./data/config.json", "r", encoding = "utf-8") as f: return _json.load(f) except: pass