From 03cf627733e5c3d1997ff28406edb04f5bf05bed Mon Sep 17 00:00:00 2001 From: Andrew Yao Date: Sun, 28 Sep 2025 11:00:47 -0700 Subject: [PATCH] Move the existing web folder to web/vanilla and update Dockerfile. --- backend/app.py | 13 ++++++++++--- docker/Dockerfile | 2 +- web/{ => vanilla}/app.js | 0 web/{ => vanilla}/index.html | 0 web/{ => vanilla}/styles.css | 0 5 files changed, 11 insertions(+), 4 deletions(-) rename web/{ => vanilla}/app.js (100%) rename web/{ => vanilla}/index.html (100%) rename web/{ => vanilla}/styles.css (100%) diff --git a/backend/app.py b/backend/app.py index e687554..1ab306b 100644 --- a/backend/app.py +++ b/backend/app.py @@ -447,9 +447,16 @@ async def get_vector_preview( logger.error(f"Error getting vector preview for {dataset_name}.{column}: {e}") raise HTTPException(status_code=500, detail="Failed to get vector preview") -# Only mount static files if the directory exists (for production) -if os.path.exists("/web"): - app.mount("/", StaticFiles(directory="/web", html=True), name="static") +# Mount static files - use vanilla version by default +# In production, Docker copies vanilla files to /web +# For local development, serve from web/vanilla +static_dir = "/web" +if not os.path.exists(static_dir): + # Local development - serve vanilla version + static_dir = os.path.join(os.path.dirname(__file__), "..", "web", "vanilla") + +if os.path.exists(static_dir): + app.mount("/", StaticFiles(directory=static_dir, html=True), name="static") if __name__ == "__main__": import uvicorn diff --git a/docker/Dockerfile b/docker/Dockerfile index 0ecff66..ac4afc7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -22,7 +22,7 @@ COPY --from=builder /root/.local /home/appuser/.local WORKDIR /app COPY backend/app.py . -COPY web/ /web/ +COPY web/vanilla/ /web/ RUN chown -R appuser:appuser /app /web RUN chmod -R 755 /web diff --git a/web/app.js b/web/vanilla/app.js similarity index 100% rename from web/app.js rename to web/vanilla/app.js diff --git a/web/index.html b/web/vanilla/index.html similarity index 100% rename from web/index.html rename to web/vanilla/index.html diff --git a/web/styles.css b/web/vanilla/styles.css similarity index 100% rename from web/styles.css rename to web/vanilla/styles.css