rq / django-rq

A simple app that provides django integration for RQ (Redis Queue)
MIT License
1.81k stars 282 forks source link

How to run django-rq worker via Webhook/API call #628

Open eznix86 opened 8 months ago

eznix86 commented 8 months ago

There are some Serverless application where running a worker is not accessible for example using Vercel.

So it would be nice to know how to run a worker temporarily via a Webhook call for example using https://cron-job.org/en/ or something similar.

eznix86 commented 8 months ago

I have tried this:

import django_rq

def run_queue(requests):
    worker = django_rq.get_worker()
    worker.work()
    return Response({'status': 'ok'})

I receive:

Screenshot 2023-11-11 at 16 13 06