完善docker配置

This commit is contained in:
小贺
2025-09-02 22:41:02 +08:00
parent 8de03156e1
commit 6b5603df84
10 changed files with 121 additions and 1 deletions

View File

@@ -1,10 +1,20 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
import random
app = FastAPI()
# 添加CORS中间件允许所有来源
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # 在生产环境中应该指定具体的域名
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
async def root():
return {"message": "Hello World"}