feat: implementar 12 mejoras, tests, docs y optimizaciones
- Fase A: license templates, search history, cost estimator - Fase B: import URL, bulk ZIP, batch download - Fase C: comparison mode, mesh validation, measurement tool - Fase D: cross-section clipping, overhang heatmap, layer animation - Refactor Pydantic/SQLAlchemy warnings - 24 tests pytest - README actualizado - WebP thumbnails, lazy loading, cache headers
This commit is contained in:
38
app/main.py
Normal file
38
app/main.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.responses import FileResponse
|
||||
from app.database import engine, Base
|
||||
from app.routers import models
|
||||
from app.migrate import run_migrations
|
||||
import os
|
||||
|
||||
# Create tables and run migrations
|
||||
Base.metadata.create_all(bind=engine)
|
||||
run_migrations()
|
||||
|
||||
app = FastAPI(title="STL Repository", version="2.1.0")
|
||||
|
||||
app.include_router(models.router)
|
||||
|
||||
# Serve static files
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
|
||||
# Serve uploads, thumbnails and images directly
|
||||
app.mount("/uploads", StaticFiles(directory="uploads"), name="uploads")
|
||||
app.mount("/thumbnails", StaticFiles(directory="thumbnails"), name="thumbnails")
|
||||
app.mount("/images", StaticFiles(directory="images"), name="images")
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def root():
|
||||
return FileResponse("static/index.html")
|
||||
|
||||
|
||||
@app.get("/upload")
|
||||
def upload_page():
|
||||
return FileResponse("static/upload.html")
|
||||
|
||||
|
||||
@app.get("/model/{model_id}")
|
||||
def detail_page(model_id: int):
|
||||
return FileResponse("static/detail.html")
|
||||
Reference in New Issue
Block a user