feat: 将flask改造成fastapi

This commit is contained in:
hackrobot
2024-03-20 19:10:14 +08:00
parent 0cce9b9a2c
commit 9ec5ffc0f1
16 changed files with 430 additions and 1 deletions

13
database.py Normal file
View File

@@ -0,0 +1,13 @@
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
SQLALCHEMY_DATABASE_URL = "sqlite:///./kunpeng.db"
# SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"
engine = create_engine(
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()