From 653d98e0761b44087cb56aea83796d9d50917f23 Mon Sep 17 00:00:00 2001 From: magowiz Date: Sat, 4 Dec 2021 17:56:31 +0100 Subject: [PATCH] add aerich configuration --- mobilizon_reshare/aerich_conf/__init__.py | 0 mobilizon_reshare/aerich_conf/database.py | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 mobilizon_reshare/aerich_conf/__init__.py create mode 100644 mobilizon_reshare/aerich_conf/database.py diff --git a/mobilizon_reshare/aerich_conf/__init__.py b/mobilizon_reshare/aerich_conf/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mobilizon_reshare/aerich_conf/database.py b/mobilizon_reshare/aerich_conf/database.py new file mode 100644 index 0000000..5afa788 --- /dev/null +++ b/mobilizon_reshare/aerich_conf/database.py @@ -0,0 +1,23 @@ +"""tortoise orm conf for aerich""" +from pathlib import Path +from mobilizon_reshare.config.config import get_settings + +CONF_FILE = "settings.toml" + +SETTINGS = get_settings(CONF_FILE) +db_path = Path(SETTINGS.db_path) + +db_url = f"sqlite:///{db_path}" + +TORTOISE_ORM = { + "connections": {"default": db_url}, + "apps": { + "models": { + "models": ["mobilizon_reshare.models.event", + "mobilizon_reshare.models.notification", + "mobilizon_reshare.models.publication", + "mobilizon_reshare.models.publisher", "aerich.models"], + "default_connection": "default", + }, + }, +}