Does django_background_tasks support django 3 and python 3.7?

Viewed 549

app/tasks.py

from background_task import background

@background(schedule=60)
def schedule_task():
    print('running_tasks')

app/views.py

schedule_task(repeat=300, repeat_until=obj.end_date)

I have placed django_background_tasks into the INSTALLED_APPS and run migrate.

But When I try to run the tasks with the command python manage.py process_tasks the command doesn't work at all. When I hit the enter after writing the command nothing happens.

1 Answers

Firstly, make sure that you are using django-background-tasks and not django-background-task.

As @phi mentioned here

There is a difference between django-background-task and django-background-tasks. django-background-task was unmaintained and incompatible with newer Django versions. We updated and extended it with new features a while ago and maintaining the new backward compatible package django-background-tasks on Github. The new django-background-tasks app can be downloaded or installed from the PyPI.

Running python manage.py process_tasks is not alone to get this working. You need to first have the server active and running and then in another terminal/cmd-line run the above command.

See here from the docs.

Related