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?
pythonw.exe
as your executable right? (using the extension.pyw
on your script will do this normally, but you might need to specify it manually when building a standaloneexe
)