I have a django application and celery, and one of the tasks is to create a tenant in '/admin'
@app.task
def create_tenant_account(form_data):
...
tenant = Company(...)
tenant.save()
...
After tenant.save() all of the migrations start applying, but suddenly the celery crashes because the code dont stoped after tenant.save() (after the save, I have some tenants setup that needs to run after)
This only happens on celery, locally it stops and runs normally.
Is there a way to prevent the code from runing?
My solution was to create another function to run after the tenant.save(), but for now, I need the setup to run in the same function.