5b7b41aa50
- Flask app with SQLAlchemy, Flask-Login, Flask-Mail - Admin/owner roles, vessel management, charters, work orders - Background launcher (Iniciar.vbs) runs server without terminal window - Root redirect fixed: / → /login - debug=False, use_reloader=False for pythonw.exe compatibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
1015 B
PowerShell
35 lines
1015 B
PowerShell
# iniciar.ps1 - Script para cargar .env y ejecutar run.py
|
|
Write-Host "Cargando variables de entorno desde .env..." -ForegroundColor Green
|
|
|
|
# Verificar si existe .env
|
|
if (-not (Test-Path ".env")) {
|
|
Write-Host "ERROR: No se encuentra el archivo .env" -ForegroundColor Red
|
|
Read-Host "Presiona Enter para salir"
|
|
exit 1
|
|
}
|
|
|
|
# Verificar si existe run.py
|
|
if (-not (Test-Path "run.py")) {
|
|
Write-Host "ERROR: No se encuentra el archivo run.py" -ForegroundColor Red
|
|
Read-Host "Presiona Enter para salir"
|
|
exit 1
|
|
}
|
|
|
|
# Cargar variables del .env
|
|
Get-Content .env | ForEach-Object {
|
|
if ( -match '^([^=]+)=(.*)$') {
|
|
$nombre = $matches[1].Trim()
|
|
$valor = $matches[2].Trim().Trim('"')
|
|
[Environment]::SetEnvironmentVariable($nombre, $valor, 'Process')
|
|
Write-Host "Cargado: $nombre = $valor" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
|
|
Write-Host "
|
|
Ejecutando run.py..." -ForegroundColor Green
|
|
python run.py
|
|
|
|
Write-Host "
|
|
Presiona Enter para salir..." -ForegroundColor Gray
|
|
Read-Host
|