Skip to content

Commit a3b828d

Browse files
committed
Fixed a database location confusion problem
1 parent 93b9c9c commit a3b828d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

ceopardy/controller.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,10 @@ def db_backup_and_create_new():
523523
_bkp_name = "ceopardy_{}_{}.db".format(
524524
datetime.now().strftime("%Y-%m-%d_%H%M"), previous_roundfile
525525
)
526-
# SQLite URI is resolved against app.instance_path; the live file lives there too.
527-
db_path = os.path.join(app.instance_path, config["DATABASE_FILENAME"])
528-
bkp_path = os.path.join(app.instance_path, _bkp_name)
526+
# The live DB and its backups sit next to the user's data/ directory
527+
# (matches SQLALCHEMY_DATABASE_URI in ceopardy/__init__.py).
528+
db_path = os.path.join(config["BASE_DIR"], config["DATABASE_FILENAME"])
529+
bkp_path = os.path.join(config["BASE_DIR"], _bkp_name)
529530
app.logger.info("Backing up current game to {}".format(bkp_path))
530531
db.session.remove()
531532
db.engine.dispose()

0 commit comments

Comments
 (0)