django-background-tasks package does not work when django-hosts package is configured.
My background task function looks something like this:
@staticmethod
@background(queue="text")
def sendMessage(phone_number, message):
I am running this function on a specific queue.
Also background task command is running too.
python3 manage.py process_tasks --queue text
My hosts configuration works properly. But not background tasks. When I remove hosts configuration background task function executes.
Did you set the
DEFAULT_HOST
setting? Since there's no HTTP request in the CLI/background task, there's no other way to detect the HOST, which could be the cause of your errors.Also, posting an actual error message with your question would be useful.