CustomIWMServer/customiwmserver/__main__.py

17 lines
387 B
Python
Raw Normal View History

2022-11-18 16:51:24 +00:00
import uvicorn
2022-12-17 18:10:58 +00:00
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)
2022-11-19 12:51:28 +00:00
2022-11-18 16:51:24 +00:00
if __name__ == "__main__":
2022-12-17 18:10:58 +00:00
server.run()