global signal handler based on Django