2024-10-02 20:11:28 +08:00
|
|
|
import uvicorn
|
2025-02-28 00:26:57 +08:00
|
|
|
|
2024-10-02 20:11:28 +08:00
|
|
|
from fastapi import FastAPI
|
|
|
|
|
from fastapi.middleware.cors import CORSMiddleware
|
2025-04-04 00:16:18 +08:00
|
|
|
from server.routers import router
|
2025-02-27 19:35:25 +08:00
|
|
|
from src.utils.logging_config import logger
|
2024-10-02 20:11:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
app = FastAPI()
|
|
|
|
|
app.include_router(router)
|
|
|
|
|
|
|
|
|
|
# CORS 设置
|
|
|
|
|
app.add_middleware(
|
|
|
|
|
CORSMiddleware,
|
|
|
|
|
allow_origins=["*"],
|
|
|
|
|
allow_credentials=True,
|
|
|
|
|
allow_methods=["*"],
|
|
|
|
|
allow_headers=["*"],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2024-10-14 22:10:56 +08:00
|
|
|
uvicorn.run(app, host="0.0.0.0", port=5000, threads=10, workers=10)
|
2024-10-02 20:11:28 +08:00
|
|
|
|