[Django]-How can I have a python module run asynchronously and recieve calls from other modules?

3👍

Celery is a task queue that reeally excels at this sort of thing.

It would allow you to do something like:

  1. user makes request to view
  2. view starts an async task that does the heavy lifting, then returns to the user immediately
  3. you can poll from javascript to see if your task is done and load the results when it is

Might not quite be the flow you’re looking for but celery is definitetly worth checking out
Celery has a great django package too, extremely easy to use

Rereading your question, i think it would also be possible to create a local webservice around your recommendation engine. On startup it can load all the data into memory, then you can just make requests to it from your django app?

Leave a comment