- 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
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
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")
|