super(Command, self).__init__(*args, **kwargs)

def _exit(self):
    for process in PROCESSES_TO_KILL:
        process.terminate()

def _handle_SIGINT(signal, frame):
    self._exit()
sys.exit(0)
Django: How to run a function when server exits?