Seth commited on
Commit
9c014c6
·
1 Parent(s): fd0ae04
Files changed (2) hide show
  1. Dockerfile +4 -1
  2. backend/app/main.py +2 -1
Dockerfile CHANGED
@@ -20,7 +20,10 @@ COPY backend /app/backend
20
  # Copy frontend build into /app/frontend/dist
21
  COPY --from=frontend-build /frontend/dist /app/frontend/dist
22
 
 
 
 
23
  # HF Spaces uses port 7860
24
  EXPOSE 7860
25
 
26
- CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
20
  # Copy frontend build into /app/frontend/dist
21
  COPY --from=frontend-build /frontend/dist /app/frontend/dist
22
 
23
+ # Set PYTHONPATH to include backend directory
24
+ ENV PYTHONPATH=/app/backend:$PYTHONPATH
25
+
26
  # HF Spaces uses port 7860
27
  EXPOSE 7860
28
 
29
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
backend/app/main.py CHANGED
@@ -228,7 +228,8 @@ async def generate_campaign(campaign_data: dict):
228
  raise HTTPException(status_code=500, detail=str(e))
229
 
230
  # ---- Frontend static serving ----
231
- FRONTEND_DIST = Path(__file__).resolve().parents[2] / "frontend" / "dist"
 
232
  INDEX_FILE = FRONTEND_DIST / "index.html"
233
 
234
  if FRONTEND_DIST.exists():
 
228
  raise HTTPException(status_code=500, detail=str(e))
229
 
230
  # ---- Frontend static serving ----
231
+ # Path calculation: /app/backend/app/main.py -> /app/frontend/dist
232
+ FRONTEND_DIST = Path("/app/frontend/dist")
233
  INDEX_FILE = FRONTEND_DIST / "index.html"
234
 
235
  if FRONTEND_DIST.exists():