Catch django signal sent from celery task. Is it possible? As far as I know they are running in different processes
@celery.task
def my_task():
...
custom_signal.send()
@receiver(custom_signal)
def my_signal_handler():
...
Please take in mind that your async task must be @shared_task decorator. in order to be called from outside since it will not be attached to a concrete app instance. Documentation @shared_task celery
task.py
@shared_task
def send_email(email):
# Do logic for sending email or other task
signal.py
as you can see below this will only execute when post_save (After user executes save) for the model Contract in your case would be anyother model that its being executed.
@receiver(post_save, sender=Contract)
def inflation_signal(sender, **kwargs):
if kwargs['created']:
send_email.delay('mymail@example.com')