How Can I create real time actions in python / django?
for more info:
Some user add some thing to database also other user add same one too (not same as they are but they have similar property) at same time (and all times) program should being check if they are objects with similar property {if they are not same check both of them in other time with all other objects that may be added/edited on database}
these actions should be in real time or at last by few minuts appart.
for example:
for every(2min):
do_job()
or
while True:
do_job()
if i use second one program will stop.
CodePudding user response:
You need to run a async task to check the objects in background. You can check this link for reference Celery doc
CodePudding user response:
In case if you have any limitations using celery or a similar approach, the other way is to create a scripts.py
inside your app(same level as models.py & views.py
) and write logic and schedule this in cron
or any scheduler based on your host server.