@echo off REM Ejecuta la app en modo desarrollo (sin empaquetar) REM Requiere Python instalado cd /d "%~dp0" echo Directorio: %CD% echo. REM Verificar Python where python >nul 2>nul if errorlevel 1 ( echo [ERROR] Python no esta en PATH. echo Instala Python 3.11+ y marca "Add Python to PATH" durante la instalacion. goto :end ) python --version if not exist .venv goto :crear_venv call .venv\Scripts\activate.bat goto :sync_deps :crear_venv echo. echo Creando venv local, puede tardar 2-3 minutos... python -m venv .venv if errorlevel 1 ( echo [ERROR] No se pudo crear el venv. goto :end ) call .venv\Scripts\activate.bat python -m pip install --upgrade pip :sync_deps REM Reinstala requirements solo si requirements.txt es mas nuevo que el marcador if not exist .venv\.deps_synced goto :do_install for /f %%i in ('dir /b /od requirements.txt .venv\.deps_synced 2^>nul') do set _newer=%%i if /i "%_newer%"==".deps_synced" goto :run_app :do_install echo. echo [INFO] Sincronizando dependencias (requirements.txt)... python -m pip install -r requirements.txt if errorlevel 1 ( echo [ERROR] Fallo la instalacion de dependencias. goto :end ) echo. > .venv\.deps_synced :run_app REM ===== Postgres en Docker (DataStage) ===== where docker >nul 2>nul if errorlevel 1 ( echo [INFO] Docker no esta instalado. La pestaña DataStage no funcionara. echo Instala Docker Desktop si vas a usarla. goto :launch_voila ) docker ps --format "{{.Names}}" | findstr /B /C:"postgres-datastage" >nul 2>nul if not errorlevel 1 ( echo [INFO] Contenedor postgres-datastage ya esta corriendo. goto :launch_voila ) echo [INFO] Levantando contenedor postgres-datastage... docker compose up -d postgres-datastage if errorlevel 1 ( echo [WARN] No se pudo levantar Postgres. La pestaña DataStage no funcionara. goto :launch_voila ) echo [INFO] Esperando a que Postgres acepte conexiones... docker compose exec -T postgres-datastage pg_isready >nul 2>nul set /a _retries=0 :wait_pg set /a _retries+=1 if %_retries% GTR 20 ( echo [WARN] Postgres tardo en levantar. Continuamos de todos modos. goto :launch_voila ) docker compose exec -T postgres-datastage pg_isready >nul 2>nul if errorlevel 1 ( timeout /t 1 /nobreak >nul goto :wait_pg ) echo [INFO] Postgres listo. :launch_voila echo. echo Lanzando la app... echo (Si el browser no abre, ve a http://127.0.0.1:8866/) echo. python launcher.py :end echo. echo ============================================================ echo Presiona cualquier tecla para cerrar... pause >nul