modified: app.py

This commit is contained in:
2026-05-15 05:12:06 -04:00
parent 33bc739e12
commit c2373c3ed6
3 changed files with 13 additions and 3 deletions

View File

@@ -1,3 +1,3 @@
{ {
"python-envs.defaultEnvManager": "ms-python.python:pyenv" "python-envs.defaultEnvManager": "ms-python.python:system"
} }

12
app.py
View File

@@ -16,6 +16,14 @@ import io
import webview import webview
import threading import threading
# --- PYINSTALLER WINDOWED MODE FIX ---
# If running as a compiled exe, redirect stdout/stderr so Flask doesn't crash
if getattr(sys, 'frozen', False) and sys.platform == "win32":
# Force output to a real file instead of the console
log_file = os.path.join(os.path.dirname(sys.executable), 'seki_crash.log')
sys.stdout = open(log_file, 'w', encoding='utf-8')
sys.stderr = sys.stdout
# from dotenv import load_dotenv # from dotenv import load_dotenv
# load_dotenv() # load_dotenv()
@@ -785,7 +793,8 @@ def delete_gasto(gasto_id):
def start_server(): def start_server():
# Use socketio.run instead of default app.run # Use socketio.run instead of default app.run
socketio.run(app, host='127.0.0.1', port=5000) #socketio.run(app, host='127.0.0.1', port=5000)
socketio.run(app, host='127.0.0.1', port=5000, log_output=False, allow_unsafe_werkzeug=True)
def run_standalone(): def run_standalone():
t = threading.Thread(target=start_server) t = threading.Thread(target=start_server)
@@ -802,6 +811,7 @@ def run_standalone():
webview.start(private_mode=False) webview.start(private_mode=False)
if __name__ == '__main__': if __name__ == '__main__':
init_db() init_db()
# For standalone desktop app with embedded browser, use # For standalone desktop app with embedded browser, use

View File

@@ -26,7 +26,7 @@ exe = EXE(
bootloader_ignore_signals=False, bootloader_ignore_signals=False,
strip=False, strip=False,
upx=True, upx=True,
console=True, console=False,
disable_windowed_traceback=False, disable_windowed_traceback=False,
argv_emulation=False, argv_emulation=False,
target_arch=None, target_arch=None,