Answer the question
In order to leave comments, you need to log in
Using django_rq?
I was sent a test task on Jun's backend, this is the first time I've come across the TK, but I seem to understand what they want from me.
But for an asynchronous worker, django_rq is required, what is it all about? I couldn't find any documentation. For the first time I come across, isn't it easier to use Celery + Redis for asynchronous work? Please tell me, and if someone painted in stages how to complete this task, I would be very grateful.
Answer the question
In order to leave comments, you need to log in
messageman django_rq is much simpler than Celery.
Dock at the link .
Just like Celery, django_rq needs Redis.
To work with Django inside a task, you will need to do something like this, usually I use a decorator
# decorators.py
import os
from functools import wraps
import django
def standalone(function):
@wraps(function)
def _wrapper(*args, **kwargs):
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'conf.settings')
django.setup()
return function(*args, **kwargs)
return _wrapper
# tasks.py
from .decorators import standalone
@standalone
def task(*args, **kwargs)
pass
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question