from mixpanel import Mixpanel from django.conf import settings from project.celery import app @app.task def transaction_to_mixpanel(user_id, amount, time, product_type): mix = Mixpanel(settings.MIX_TOKEN) mix.people_track_charge( user_id, amount, { '$time': time, 'product_type': product_type, } )