From a5fe21c9e03aeed425bb676d8cf1c0879d24c013 Mon Sep 17 00:00:00 2001 From: Jan Broer Date: Tue, 4 Aug 2015 01:44:05 +0200 Subject: [PATCH] Add APP_DB_ROOT config variable --- cps/config.py | 3 +++ cps/ub.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cps/config.py b/cps/config.py index a7bbc875..4836e22f 100755 --- a/cps/config.py +++ b/cps/config.py @@ -44,6 +44,7 @@ def check_setting_int(config, cfg_name, item_name, def_val): CheckSection('General') DB_ROOT = check_setting_str(CFG, 'General', 'DB_ROOT', os.path.join(os.getcwd(), "Calibre Library")) +APP_DB_ROOT = check_setting_str(CFG, 'General', 'APP_DB_ROOT', os.getcwd()) TEMPLATEDIR = check_setting_str(CFG, 'General', 'TEMPLATEDIR', os.path.join(os.getcwd(), "views")) MAIN_DIR = check_setting_str(CFG, 'General', 'MAIN_DIR', os.getcwd()) PORT = check_setting_int(CFG, 'General', 'PORT', 8083) @@ -59,6 +60,7 @@ SYS_ENCODING="UTF-8" configval={} configval["DB_ROOT"] = DB_ROOT +configval["APP_DB_ROOT"] = APP_DB_ROOT configval["TEMPLATEDIR"] = TEMPLATEDIR configval["MAIN_DIR"] = MAIN_DIR configval["PORT"] = PORT @@ -72,6 +74,7 @@ def save_config(configval): new_config.filename = CONFIG_FILE new_config['General'] = {} new_config['General']['DB_ROOT'] = configval["DB_ROOT"] + new_config['General']['APP_DB_ROOT'] = configval["APP_DB_ROOT"] new_config['General']['TEMPLATEDIR'] = configval["TEMPLATEDIR"] new_config['General']['MAIN_DIR'] = configval["MAIN_DIR"] new_config['General']['PORT'] = configval["PORT"] diff --git a/cps/ub.py b/cps/ub.py index 2745e3bd..c5e490ec 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -8,7 +8,7 @@ import os from cps import config from werkzeug.security import generate_password_hash -dbpath = os.path.join(config.MAIN_DIR, "app.db") +dbpath = os.path.join(config.APP_DB_ROOT, "app.db") engine = create_engine('sqlite:///{0}'.format(dbpath), echo=False) Base = declarative_base()