mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-10-25 00:56:14 +08:00
实现配置文件插拔式设计
This commit is contained in:
+2
-2
@@ -9,7 +9,7 @@ import records
|
||||
|
||||
from records import Connection
|
||||
from config.log import logger
|
||||
from config import setting
|
||||
from config import settings
|
||||
|
||||
|
||||
class Database(object):
|
||||
@@ -29,7 +29,7 @@ class Database(object):
|
||||
return db_path
|
||||
protocol = 'sqlite:///'
|
||||
if not db_path: # 数据库路径为空连接默认数据库
|
||||
db_path = f'{protocol}{setting.result_save_dir}/result.sqlite3'
|
||||
db_path = f'{protocol}{settings.result_save_dir}/result.sqlite3'
|
||||
else:
|
||||
db_path = protocol + db_path
|
||||
db = records.Database(db_path) # 不存在数据库时会新建一个数据库
|
||||
|
||||
Reference in New Issue
Block a user