You've already forked RekomenciBackend
feat(): format & proper startup (make main async for uvicorn to inherit current asyncio event loop)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import asyncio
|
||||
import sys
|
||||
from logging.config import fileConfig
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -7,6 +9,9 @@ from sqlalchemy import pool
|
||||
|
||||
from alembic import context
|
||||
|
||||
if sys.platform == "win32":
|
||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||
|
||||
from template_project.web_api.configuration import load_configuration
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
@@ -23,11 +28,13 @@ if config.config_file_name is not None:
|
||||
# from myapp import mymodel
|
||||
# target_metadata = mymodel.Base.metadata
|
||||
from template_project.adapters.data_gateways.tables import meta_data
|
||||
|
||||
target_metadata = meta_data
|
||||
|
||||
configuration = load_configuration(Path(os.environ["CONFIGURATION_PATH"]))
|
||||
config.set_main_option("sqlalchemy.url", configuration.database.url.get_value())
|
||||
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
# can be acquired:
|
||||
# my_important_option = config.get_main_option("my_important_option")
|
||||
|
||||
Reference in New Issue
Block a user