How to interrupt Django control command

I tried BaseCommand to create my own control command as described here . It's a lengthy process though, and I want to be able to interrupt it and close it gracefully when I send it ctrl + c.

I tried normal signal.signal (signal.SIGINT, signal_handler), but signal_handler is never called. Django seems to have its own signal handling system but I've made responders for three django.core.signals got_request_exception, request_finished and request_started, but none of the ones that get called.


source to share

All Articles