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>
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
' Fleet Management — Inicia servidor en segundo plano (sin ventana)
|
|
Option Explicit
|
|
Dim oShell, sDir, sPython, sLog
|
|
|
|
sDir = "C:\fleet-management"
|
|
sPython = "C:\fleet-management\venv\Scripts\pythonw.exe"
|
|
sLog = sDir & "\logs\server.log"
|
|
|
|
Set oShell = CreateObject("WScript.Shell")
|
|
|
|
' Crear carpeta de logs si no existe
|
|
Dim oFS
|
|
Set oFS = CreateObject("Scripting.FileSystemObject")
|
|
If Not oFS.FolderExists(sDir & "\logs") Then
|
|
oFS.CreateFolder(sDir & "\logs")
|
|
End If
|
|
|
|
Dim oExec, sOut
|
|
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5010 | findstr LISTENING")
|
|
sOut = oExec.StdOut.ReadAll()
|
|
If Len(Trim(sOut)) > 0 Then
|
|
' Ya esta corriendo — solo abrir el browser
|
|
oShell.Run "http://localhost:5010", 1, False
|
|
WScript.Quit
|
|
End If
|
|
|
|
' Iniciar servidor oculto
|
|
oShell.Run "cmd /c cd /d """ & sDir & """ && """ & sPython & """ run.py >> """ & sLog & """ 2>&1", 0, False
|
|
|
|
WScript.Sleep 2000
|
|
|
|
' Verificar y abrir browser
|
|
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5010 | findstr LISTENING")
|
|
sOut = oExec.StdOut.ReadAll()
|
|
If Len(Trim(sOut)) > 0 Then
|
|
oShell.Run "http://localhost:5010", 1, False
|
|
Else
|
|
MsgBox "El servidor no respondio. Revisa logs\server.log", 48, "Fleet Management"
|
|
End If
|