开发者

django app that runs constantly in the backend

开发者 https://www.devze.com 2023-01-30 04:07 出处:网络
hey guys, im trying to run a script in the backend of my django project, i have used django signals to call my script and run it when foo class is saved, and in the foo class theres a variable that ca

hey guys, im trying to run a script in the backend of my django project, i have used django signals to call my script and run it when foo class is saved, and in the foo class theres a variable that can be true or false, if its true it calls an infinte loop that runs a function every x seconds, but since this is an infinite loop, its keeping th开发者_C百科e django HTTPRequest active, so the page never finishes loading, is there a way to bipass this behavior ?


If you want to run tasks asynchronously have a look at django-celery!

EDIT: of course you can also set up a good old cron job on your system....

0

精彩评论

暂无评论...
验证码 换一张
取 消