CustomIWMServer/customiwmserver/__main__.py
2022-12-17 19:10:58 +01:00

16 lines
387 B
Python

import uvicorn
import signal
config = uvicorn.Config("customiwmserver.main:app", host="0.0.0.0", port=8001, reload=True)
server = uvicorn.Server(config)
def exit_now(signum, frame):
global server
print("STOPPING")
server.handle_exit(signum, frame)
signal.signal(signal.SIGINT, exit_now)
signal.signal(signal.SIGTERM, exit_now)
if __name__ == "__main__":
server.run()