medilang-tech / debug_main.py
Dama03's picture
first push of the AI
411a994
raw
history blame
1.16 kB
import logging
import asyncio
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
import uvicorn
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
app = FastAPI()
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Simple health check endpoint
@app.get("/health")
async def healthcheck():
return {"status": "ok"}
# Test endpoint that doesn't use any external services
@app.get("/test")
async def test_endpoint():
return {"message": "Test endpoint working"}
# Test endpoint that simulates a delay
@app.get("/test-delay")
async def test_delay(seconds: float = 2.0):
await asyncio.sleep(seconds)
return {"message": f"Delayed response after {seconds} seconds"}
if __name__ == "__main__":
uvicorn.run(
"debug_main:app",
host="0.0.0.0",
port=8000,
reload=True,
log_level="info"
)