[Python] Python uvicorn app opens a cmd - how to stop it?

Discussão em 'Python' iniciado por Stack, Abril 29, 2025.

  1. Stack

    Stack Membro Participativo

    I've been building a WebSocket application and I opted for Python FastAPI + Uvicorn for server side. Having pretty much finished the app, I decided to pack the server into an .exe file. Even though I used pyinstaller with --noconsole flag, whenever I launch my server using the following snippet:

    config = uvicorn.Config(
    app,
    host="0.0.0.0",
    port=exposed_port,
    access_log=False,
    reload=False,
    log_config=None
    )

    server = uvicorn.Server(config)
    server_thread = threading.Thread(target=server.run, daemon=True)
    server_thread.start()


    a cmd launches. The cmd does not contain any logs whatsoever, it is completely empty, but once I close it, the server shuts down.

    Is there any way to either hide the cmd, or get rid of it fully?

    Continue reading...

Compartilhe esta Página