legacy-code-challenge-v2 / RENDER_FIX.md
refaelz's picture
Initial commit for Hugging Face
532e19f
|
Raw History Blame Contribute Delete
2.88 kB

🚀 Render Deployment Fix

הבעיה

Render ממשיך להריץ gunicorn app:app אבל gunicorn לא מותקן (הסרנו אותו).

✅ הפתרון (3 דקות)

אופציה 1: עדכון ידני (מהיר!)

  1. לך ל-Render Dashboard → בחר את השירות שלך

  2. Settings → Build & Deploy

  3. Start Command - החלף ל:

    uvicorn app:app --host 0.0.0.0 --port $PORT
    
  4. Save Changes

  5. Manual Deploy → Deploy latest commit


אופציה 2: מחיקה ויצירה מחדש (נקי!)

שלב 1: מחק את השירות הישן

  • Settings → Danger Zone → Delete Web Service

שלב 2: צור שירות חדש

  1. New → Web Service

  2. Repository: refaelz1/LegacyInterview

  3. Name: legacy-code-challenge

  4. Runtime: Python 3

  5. Build Command:

    apt-get update && apt-get install -y git && pip install -r requirements.txt
    
  6. Start Command:

    uvicorn app:app --host 0.0.0.0 --port $PORT
    
  7. Environment Variables:

    • PORT = 10000
    • OPENAI_API_KEY = (leave empty - users will provide)
  8. Create Web Service


📝 מה אמור לקרות אחרי התיקון

Build Logs:

==> Installing dependencies from ./requirements.txt
Collecting uvicorn[standard]
  ✓ Installed uvicorn successfully
==> Build successful 🎉

Deploy Logs:

==> Deploying...
==> Running 'uvicorn app:app --host 0.0.0.0 --port $PORT'
🚀 Starting Legacy Code Challenge on port 10000...
🔐 No API key found — login page will be shown
INFO:     Started server process [68]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
==> Your service is live 🎉

🧪 בדיקה

  1. פתח את ה-URL שRender נתן לך

  2. אמור לראות Login Page עם:

    • שדה "Your Name"
    • שדה "OpenAI API Key"
    • כפתור "Continue"
  3. אם אתה מקומי (.env עם API key), תראה ישר את Setup Page


⚙️ קבצים רלוונטיים

  • requirements.txt - מכיל uvicorn[standard]
  • app.py - חושף app = demo.app לuvicorn
  • Procfile - web: uvicorn app:app --host 0.0.0.0 --port $PORT
  • render.yaml - הגדרות אוטומטיות (אבל Render מתעלם מזה לפעמים)

🐛 Troubleshooting

שגיאה: bash: uvicorn: command not found

פתרון: Clear build cache ב-Settings

שגיאה: TypeError: FastAPI.__call__() missing 1 required positional argument

פתרון: אתה עדיין מריץ gunicorn - עדכן Start Command!

שגיאה: git: command not found

פתרון: הוסף apt-get update && apt-get install -y git ל-Build Command