ar9avg's picture
fix
63d67f0
raw
history blame contribute delete
969 Bytes
"""
server/app.py — Self-Improving SQL Agent
=========================================
Entry point for multi-mode deployment (uv / pyproject.toml).
Adds the backend directory to sys.path so all backend modules are importable,
then re-exports the FastAPI application as `app`.
"""
from __future__ import annotations
import os
import sys
# Make backend modules importable when running from repo root
_BACKEND = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "backend")
if _BACKEND not in sys.path:
sys.path.insert(0, _BACKEND)
from main import app # noqa: E402 (FastAPI application)
def main() -> None:
"""Entry point for `[project.scripts] server = 'server.app:main'`."""
import uvicorn
port = int(os.environ.get("PORT", os.environ.get("GRADIO_SERVER_PORT", "7860")))
uvicorn.run(
"server.app:app",
host="0.0.0.0",
port=port,
log_level="info",
)
if __name__ == "__main__":
main()