feat: 配置写死与 baked 模块,Alembic 建表,百度仅 BAIDU_*
- 新增 app/baked/algorithm|pipeline,非部署参数不再走 env;Settings 保留 DB/HTTP/RTSP/海康/百度/MinIO/Demo - 移除 init_db_schema 与 reload 配置;main 仅 check_database;start*.sh 在 uvicorn 前执行 alembic upgrade head - 依赖 psycopg[binary] 供 Alembic 同步 URL;alembic/env 注释与预发清单更新 - 撕段门控消费管线、各视频/语音/归档调用改为 baked - 百度环境变量仅 BAIDU_APP_ID、BAIDU_API_KEY、BAIDU_SECRET_KEY 与 BAIDU_* 超时/ASR;人脸脚本与 baidu_speech 文案同步 - 全量单测与 .env.example 更新;.gitignore 忽略 refs/(本地权重/视频不入库) Made-with: Cursor
This commit is contained in:
16
main.py
16
main.py
@@ -8,7 +8,7 @@ from loguru import logger
|
||||
|
||||
from app.api import router as api_router
|
||||
from app.config import settings
|
||||
from app.database import check_database, engine, init_db_schema
|
||||
from app.database import check_database, engine
|
||||
from app.dependencies import build_container
|
||||
|
||||
|
||||
@@ -28,14 +28,10 @@ def configure_logging() -> None:
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
await check_database()
|
||||
if settings.auto_create_schema:
|
||||
await init_db_schema()
|
||||
logger.info("Database connection verified; schema auto-created (dev mode)")
|
||||
else:
|
||||
logger.info(
|
||||
"Database connection verified; auto_create_schema=false, "
|
||||
"expecting 'alembic upgrade head' to have run"
|
||||
)
|
||||
logger.info(
|
||||
"Database connection verified; ensure schema is applied with "
|
||||
"`alembic upgrade head` before serving traffic"
|
||||
)
|
||||
container = build_container(settings)
|
||||
app.state.container = container
|
||||
await container.start()
|
||||
@@ -89,7 +85,7 @@ def main() -> None:
|
||||
"main:app",
|
||||
host=settings.server_host,
|
||||
port=settings.server_port,
|
||||
reload=settings.server_reload,
|
||||
reload=False,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user