Álvaro Valenzuela Valdes commited on
Commit ·
1d5f736
1
Parent(s): 9e4bb05
🚀 Fix: Port 7860 and absolute DB path for HF Spaces
Browse files- backend/Dockerfile +3 -3
- backend/app/database.py +4 -1
backend/Dockerfile
CHANGED
|
@@ -34,8 +34,8 @@ USER user
|
|
| 34 |
|
| 35 |
# Health check
|
| 36 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 37 |
-
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:
|
| 38 |
|
| 39 |
-
EXPOSE
|
| 40 |
|
| 41 |
-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 34 |
|
| 35 |
# Health check
|
| 36 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 37 |
+
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/api/health').read()" || exit 1
|
| 38 |
|
| 39 |
+
EXPOSE 7860
|
| 40 |
|
| 41 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
backend/app/database.py
CHANGED
|
@@ -3,7 +3,10 @@ from sqlalchemy.ext.declarative import declarative_base
|
|
| 3 |
from sqlalchemy.orm import sessionmaker
|
| 4 |
from app.config import settings
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# SQLite specific config for FastAPI multi-threading
|
| 9 |
connect_args = {"check_same_thread": False} if SQLALCHEMY_DATABASE_URL.startswith("sqlite") else {}
|
|
|
|
| 3 |
from sqlalchemy.orm import sessionmaker
|
| 4 |
from app.config import settings
|
| 5 |
|
| 6 |
+
import os
|
| 7 |
+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 8 |
+
default_db_path = f"sqlite:///{os.path.join(BASE_DIR, 'andesops.db')}"
|
| 9 |
+
SQLALCHEMY_DATABASE_URL = settings.database_url or default_db_path
|
| 10 |
|
| 11 |
# SQLite specific config for FastAPI multi-threading
|
| 12 |
connect_args = {"check_same_thread": False} if SQLALCHEMY_DATABASE_URL.startswith("sqlite") else {}
|