I am using a custom Django
command that is supposed to run a bunch of cleanup functions upon termination. This works fine as long as I don't use the autoreloader: by server catches the KeyboardInterrupt exception properly and exits gracefully.
However, if I use Django's autoreloader, the reloader seems to simply kill the server thread without properly terminating it (as far as I can tell, it doesn't have any means to do this).
This seems inherently unsafe, so I can't really believe that there's not a better way of handling this.
Can I somehow use the autoreloader functionality without having my server thread be killed uncleanly?