16 lines
387 B
Python
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()
|