refactor(settings): use shutil.move for file relocation
Some checks are pending
Docker / build (push) Waiting to run
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:
parent
8e48bce180
commit
9d99063846
1 changed files with 2 additions and 1 deletions
|
@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Necessary for assynchronous django
|
# Necessary for assynchronous django
|
||||||
|
@ -98,7 +99,7 @@ WSGI_APPLICATION = "moneropro.wsgi.application"
|
||||||
opt_path = Path("/opt/db.sqlite3")
|
opt_path = Path("/opt/db.sqlite3")
|
||||||
|
|
||||||
if opt_path.exists():
|
if opt_path.exists():
|
||||||
opt_path.rename(BASE_DIR / "db.sqlite3")
|
shutil.move(opt_path, BASE_DIR / "db.sqlite3")
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
"default": {
|
"default": {
|
||||||
|
|
Loading…
Reference in a new issue