alexp97 commited on
Commit
e19dd51
·
1 Parent(s): 42098b2

docs(ejecucion)+scripts: arranque manual con -u/PYTHONUNBUFFERED, --log-level y --reload-exclude por capa

Browse files

- Option B del runbook y los launchers usan python -u + PYTHONUNBUFFERED=1 (logs en vivo),
--log-level info y --reload-exclude para no reiniciar por dirs no-fuente.
- Cada servicio excluye la capa del otro (backend ignora frontend/ y viceversa) + docs/tests/etc.
- Verificado: el backend arranca con el comando completo (HTTP 200).

docs/ejecucion.md CHANGED
@@ -87,17 +87,27 @@ cp .env.example .env
87
 
88
  > Se usa `python -m uvicorn` (no los shims `uvicorn.exe`/`shiny.exe`, que OneDrive bloquea).
89
  > La app Shiny es ASGI, por lo que `uvicorn frontend.app:app` equivale a `shiny run frontend/app.py`.
 
 
90
 
91
  **Terminal 1 — Backend / API:**
92
  ```powershell
93
  $env:UV_PROJECT_ENVIRONMENT = "$env:LOCALAPPDATA\agrovision-venv"
94
- uv run python -m uvicorn backend.main:app --host 127.0.0.1 --port 8000 --reload
 
 
 
 
95
  ```
96
 
97
  **Terminal 2 — UI (Shiny):**
98
  ```powershell
99
  $env:UV_PROJECT_ENVIRONMENT = "$env:LOCALAPPDATA\agrovision-venv"
100
- uv run python -m uvicorn frontend.app:app --host 127.0.0.1 --port 8001 --reload
 
 
 
 
101
  ```
102
 
103
  ### 3.3 Puertos y Accesos Locales
 
87
 
88
  > Se usa `python -m uvicorn` (no los shims `uvicorn.exe`/`shiny.exe`, que OneDrive bloquea).
89
  > La app Shiny es ASGI, por lo que `uvicorn frontend.app:app` equivale a `shiny run frontend/app.py`.
90
+ >
91
+ > **Flags útiles:** `PYTHONUNBUFFERED=1` + `python -u` → logs en vivo sin buffer. `--log-level info` → trazas de cada request. `--reload-exclude` → evita reinicios por cambios en carpetas que no son código de ese servicio (cada servicio **excluye la capa del otro**: el backend ignora `frontend/` y viceversa, además de `docs/`, `tests/`, etc.). *(No usamos `alembic`; las migraciones son SQL en `supabase/migrations`.)*
92
 
93
  **Terminal 1 — Backend / API:**
94
  ```powershell
95
  $env:UV_PROJECT_ENVIRONMENT = "$env:LOCALAPPDATA\agrovision-venv"
96
+ $env:PYTHONUNBUFFERED = "1"
97
+ uv run python -u -m uvicorn backend.main:app --host 127.0.0.1 --port 8000 --reload --log-level info `
98
+ --reload-exclude ".venv" --reload-exclude "frontend" --reload-exclude "docs" `
99
+ --reload-exclude "tests" --reload-exclude "scripts" --reload-exclude "supabase" `
100
+ --reload-exclude "models" --reload-exclude "sample_data" --reload-exclude "scratch"
101
  ```
102
 
103
  **Terminal 2 — UI (Shiny):**
104
  ```powershell
105
  $env:UV_PROJECT_ENVIRONMENT = "$env:LOCALAPPDATA\agrovision-venv"
106
+ $env:PYTHONUNBUFFERED = "1"
107
+ uv run python -u -m uvicorn frontend.app:app --host 127.0.0.1 --port 8001 --reload --log-level info `
108
+ --reload-exclude ".venv" --reload-exclude "backend" --reload-exclude "docs" `
109
+ --reload-exclude "tests" --reload-exclude "scripts" --reload-exclude "supabase" `
110
+ --reload-exclude "models" --reload-exclude "sample_data" --reload-exclude "scratch"
111
  ```
112
 
113
  ### 3.3 Puertos y Accesos Locales
scripts/run_backend.ps1 CHANGED
@@ -6,6 +6,11 @@ $env:UV_PROJECT_ENVIRONMENT = "$env:LOCALAPPDATA\agrovision-venv"
6
  $env:UV_LINK_MODE = "copy"
7
 
8
  uv sync
9
- # Se usa "python -m uvicorn" (no el shim uvicorn.exe) para evitar errores de
10
- # ejecución en carpetas sincronizadas por OneDrive.
11
- uv run python -m uvicorn backend.main:app --host 127.0.0.1 --port 8000 --reload
 
 
 
 
 
 
6
  $env:UV_LINK_MODE = "copy"
7
 
8
  uv sync
9
+ # Se usa "python -u -m uvicorn" (no el shim uvicorn.exe) para evitar errores de
10
+ # ejecución en carpetas sincronizadas por OneDrive; -u/PYTHONUNBUFFERED dan logs en vivo.
11
+ # --reload-exclude evita reinicios por cambios fuera del código del backend (incluye frontend/).
12
+ $env:PYTHONUNBUFFERED = "1"
13
+ uv run python -u -m uvicorn backend.main:app --host 127.0.0.1 --port 8000 --reload --log-level info `
14
+ --reload-exclude ".venv" --reload-exclude "frontend" --reload-exclude "docs" `
15
+ --reload-exclude "tests" --reload-exclude "scripts" --reload-exclude "supabase" `
16
+ --reload-exclude "models" --reload-exclude "sample_data" --reload-exclude "scratch"
scripts/run_ui.ps1 CHANGED
@@ -4,6 +4,11 @@ Set-Location (Split-Path -Parent $PSScriptRoot)
4
  $env:UV_PROJECT_ENVIRONMENT = "$env:LOCALAPPDATA\agrovision-venv"
5
  $env:UV_LINK_MODE = "copy"
6
 
7
- # La app Shiny es ASGI: se sirve con uvicorn (python -m) para evitar el shim
8
  # shiny.exe, que OneDrive bloquea. Equivale a `shiny run frontend/app.py`.
9
- uv run python -m uvicorn frontend.app:app --host 127.0.0.1 --port 8001 --reload
 
 
 
 
 
 
4
  $env:UV_PROJECT_ENVIRONMENT = "$env:LOCALAPPDATA\agrovision-venv"
5
  $env:UV_LINK_MODE = "copy"
6
 
7
+ # La app Shiny es ASGI: se sirve con uvicorn (python -u -m) para evitar el shim
8
  # shiny.exe, que OneDrive bloquea. Equivale a `shiny run frontend/app.py`.
9
+ # --reload-exclude evita reinicios por cambios fuera del código de la UI (incluye backend/).
10
+ $env:PYTHONUNBUFFERED = "1"
11
+ uv run python -u -m uvicorn frontend.app:app --host 127.0.0.1 --port 8001 --reload --log-level info `
12
+ --reload-exclude ".venv" --reload-exclude "backend" --reload-exclude "docs" `
13
+ --reload-exclude "tests" --reload-exclude "scripts" --reload-exclude "supabase" `
14
+ --reload-exclude "models" --reload-exclude "sample_data" --reload-exclude "scratch"