Hi, I have a Django app that I'm using with PredictionIO (http://prediction.io/), which is a wrapper around Apache Mahout.
They also have a Python client that sends data to the backend server: http://pythonhosted.org/PredictionIO/predictionio.html As part of this, I've attached post_save signals to my Django models, so that I create the appropriate PredictionIO users and items when the Django models get created. So in my models.py files, I have things like: from django.dispatch import receiver > from django.db.models.signals import post_save > import predictionio > ... > client = > predictionio.Client(appkey="pEICENyM27veyCwxj0R7LgeK8WnSg9TV5ediToCciuZAkUkLFVmZw9lOCWEqYu5s") > ... > class Product(models.Model): > ...define Product fields... > ... > @receiver(post_save, sender=Product) > def create_recommender_product(sender, instance=None, created=False, > **kwargs): > if created: > client.create_item(str(instance.id), ('type1',)) I have a similar setup for my custom User model, and also a post_save signal for when a user likes/dislikes a product. My question is - I've put the client creation code at the top of models.py - my understanding was this only gets called once when we first read in models.py, then it gets re-used each time. Is the above good practice? And also, the prediction.io calls in my post_save functions are all blocking - is that a major issue? Should I be shoving this into something like Celery, or is the above acceptable? Cheers, Victor -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.