async def run(self): db_register(make_db_url()) initialize(self.migration_dir)
from starlette.middleware.cors import CORSMiddleware from starlette.requests import Request from starlette.routing import Router, Mount from starlette.staticfiles import StaticFiles from starlette.responses import RedirectResponse, FileResponse, JSONResponse from starlette.exceptions import HTTPException from boucanpy.core.utils import webui_dir, landing_dir from boucanpy.core import logger from boucanpy.api.routers import routers from boucanpy.api.websocket import broadcast_index, broadcast_auth from boucanpy.db.session import session, db_register from boucanpy.db.utils import make_db_url db_register(make_db_url()) from boucanpy.api import ( config, ) # environment must be loaded, dabatabse must be registerd # CORS api = FastAPI(title=config.API_PROJECT_NAME, openapi_url="/api/v1/openapi.json") origins = [] # Set all CORS enabled origins if config.API_CORS_ORIGINS: origins_raw = config.API_CORS_ORIGINS.split(",") for origin in origins_raw:
async def run(self): db_register(make_db_url()) migrate(self.migration_dir)
async def run(self): env = self.option("env") db_register(make_db_url()) downgrade(self.migration_dir)