refactor(settings): use shutil.move for file relocation
Some checks are pending
Docker / build (push) Waiting to run

Replaced `Path.rename` with `shutil.move` to handle the database file relocation. This change accommodates cross-filesystem moves, improving robustness in environments where the source and destination may reside on different filesystems. No changes to database access or usage logic have been made.
This commit is contained in:
Kumi 2024-11-12 14:13:52 +01:00
parent 8e48bce180
commit 9d99063846
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
import shutil
from pathlib import Path
# Necessary for assynchronous django
@ -98,7 +99,7 @@ WSGI_APPLICATION = "moneropro.wsgi.application"
opt_path = Path("/opt/db.sqlite3")
if opt_path.exists():
opt_path.rename(BASE_DIR / "db.sqlite3")
shutil.move(opt_path, BASE_DIR / "db.sqlite3")
DATABASES = {
"default": {