初次提交

This commit is contained in:
2025-10-14 20:05:29 +08:00
commit 6e4e48fdd2
673 changed files with 437006 additions and 0 deletions

95
backend/clean_server.py Normal file
View File

@@ -0,0 +1,95 @@
#!/usr/bin/env python3
print("Starting Cloud Drive Application Server...")
import sys
print(f"Python version: {sys.version}")
try:
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
print("FastAPI dependencies available")
app = FastAPI(
title="Cloud Drive API",
description="Modern Cloud Storage Web Application Backend API",
version="1.0.0",
docs_url="/docs",
redoc_url="/redoc"
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
async def root():
return {
"message": "Cloud Drive API",
"version": "1.0.1",
"docs": "/docs",
"health": "/api/v1/health"
}
@app.get("/health")
async def health():
return {"status": "healthy"}
@app.get("/api/v1/health")
async def api_health():
import time
return {
"status": "healthy",
"timestamp": time.time(),
"version": "1.0.0"
}
@app.get("/test")
async def test():
return {"test": "ok", "server": "working"}
try:
from app.core.config import settings
print("Full app module available")
mode = "full"
except ImportError:
print("Using simplified mode")
mode = "simplified"
@app.get("/info")
async def info():
return {
"mode": mode,
"python_version": str(sys.version),
"status": "running"
}
print("=" * 50)
print("Server URLs:")
print(" http://localhost:8080")
print(" http://localhost:8080/docs")
print(" http://localhost:8080/api/v1/health")
print("=" * 50)
print("Press Ctrl+C to stop server")
print()
uvicorn.run(
app,
host="0.0.0.0",
port=8080,
reload=False,
access_log=True,
log_level="info"
)
except ImportError as e:
print(f"Dependency import failed: {e}")
print("Please run: pip install fastapi uvicorn")
sys.exit(1)
except Exception as e:
print(f"Startup failed: {e}")
sys.exit(1)