Add APP_DB_ROOT config variable

pull/5/head
Jan Broer 10 years ago
parent 0b5b3b8424
commit a5fe21c9e0

@ -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"]

@ -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()

Loading…
Cancel
Save