mirror of
https://github.com/gmbrax/Pilgrim.git
synced 2026-11-10 01:20:16 +00:00
Fix the Database no being put on the right path according with the config.toml
This commit is contained in:
parent
bdaa37e355
commit
967c7e4ce6
+10
-3
@@ -12,10 +12,17 @@ Base = declarative_base()
|
||||
|
||||
|
||||
class Database:
|
||||
def __init__(self,config_manager:ConfigManager):
|
||||
db_path = config_manager.database_url
|
||||
|
||||
def __init__(self, config_manager: ConfigManager):
|
||||
self.db_path = config_manager.database_url
|
||||
|
||||
# Garantir que o diretório existe
|
||||
db_dir = os.path.dirname(self.db_path)
|
||||
if not os.path.exists(db_dir):
|
||||
os.makedirs(db_dir, exist_ok=True)
|
||||
|
||||
self.engine = create_engine(
|
||||
f"sqlite:///{config_manager.database_url}",
|
||||
f"sqlite:///{self.db_path}",
|
||||
echo=False,
|
||||
connect_args={"check_same_thread": False},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user