A look at celery/django-celery-beat: 2.0k stars on GitHub, written primarily in Python, tracked under the Backend category. Celery Periodic Tasks backed by the Django ORM
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
.. warning::
If you change the Django TIME_ZONE setting your periodic task schedule
will still be based on the old timezone.
To fix that you would have to reset the "last run time" for each periodic task:
.. code-block:: Python
>>> from django_celery_beat.models import PeriodicTask, PeriodicTasks
>>> PeriodicTask.objects.all().update(last_run_at=None)
>>> PeriodicTasks.update_changed()
.. note::
This will reset the state as if the periodic tasks have never run before.
Models
django_celery_beat.models.PeriodicTask
This model defines a single periodic task to be run.
It must be associated with a schedule, which defines how often the task should
run.
django_celery_beat.models.IntervalSchedule
A schedule that runs at a specific interval (e.g. every 5 seconds).
django_celery_beat.models.CrontabSchedule
A schedule with fields like entries in cron:
minute hour day-of-week day_of_month month_of_year.
django_celery_beat.models.PeriodicTasks
This model is only used as an index to keep track of when the schedule has
changed.
Whenever you update a PeriodicTask a counter in this table is also
incremented, which tells the celery beat service to reload the schedule
from the database.
If you update periodic tasks in bulk, you will need to update the counter
manually:
.. code-block:: Python
>>> from django_celery_beat.models import PeriodicTasks
>>> PeriodicTasks.update_changed()
Example creating interval-based periodic task
To create a periodic task executing at an interval you must first
create the interval object:
.. code-block:: Python
>>> from django_celery_beat.models import PeriodicTask, IntervalSchedule
# executes every 10 seconds.
>>> schedule, created = IntervalSchedule.objects.get_or_create(
... every=10,
... period=IntervalSchedule.SECONDS,
... )
That's all the fields you need: a period type and the frequency.
You can choose between a specific set of periods:
IntervalSchedule.DAYS
IntervalSchedule.HOURS
IntervalSchedule.MINUTES
IntervalSchedule.SECONDS
IntervalSchedule.MICROSECONDS
.. note::
If you have multiple periodic tasks executing every 10 seconds,
then they should all point to the same schedule object.
There's also a "choices tuple" available should you need to present this
to the user:
.. code-block:: Python
>>> IntervalSchedule.PERIOD_CHOICES
Now that we have defined the schedule object, we can create the periodic task
entry:
.. code-block:: Python
>>> PeriodicTask.objects.create(
... interval=schedule, # we created this above.
... name='Importing contacts', # simply describes this periodic task.
... task='proj.tasks.import_contacts', # name of task.
... )
Note that this is a very basic example, you can also specify the arguments
and keyword arguments used to execute the task, the queue to send it
to[*], and set an expiry time.
Here's an example specifying the arguments, note how JSON serialization is
required:
.. code-block:: Python
>>> import json
>>> from datetime import datetime, timedelta
>>> PeriodicTask.objects.create(
... interval=schedule, # we created this above.
... name='Importing contacts', # simply describes this periodic task.
... task='proj.tasks.import_contacts', # name of task.
... args=json.dumps(['arg1', 'arg2']),
... kwargs=json.dumps({
... 'be_careful': True,
... }),
... expires=datetime.utcnow() + timedelta(seconds=30)
... )
.. [*] you can also use low-level AMQP routing using the exchange and
routing_key fields.
Example creating crontab-based periodic task
A crontab schedule has the fields: minute, hour, day_of_week,
day_of_month and month_of_year, so if you want the equivalent
of a 30 * * * * (execute 30 minutes past every hour) crontab entry you specify:
The crontab schedule is linked to a specific timezone using the 'timezone' input parameter.
Then to create a periodic task using this schedule, use the same approach as
the interval-based periodic task earlier in this document, but instead
of interval=schedule, specify crontab=schedule:
The periodic tasks still need 'workers' to execute them.
So make sure the default Celery package is installed.
(If not installed, please follow the installation instructions
here: https://github.com/celery/celery)
Both the worker and beat services need to be running at the same time.
Start a Celery worker service (specify your Django project name)::
$ celery -A [project-name] worker --loglevel=info
As a separate process, start the beat service (specify the Django scheduler)::
$ celery -A [project-name] beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
OR you can use the -S (scheduler flag), for more options see celery beat --help)::
$ celery -A [project-name] beat -l info -S django
Also, as an alternative, you can run the two steps above (worker and beat services)
with only one command (recommended for development environment only)::
$ celery -A [project-name] worker --beat --scheduler django --loglevel=info
Now you can add and manage your periodic tasks from the Django Admin interface.
Installation
You can install django-celery-beat either via the Python Package Index (PyPI)
or from source.
To install using pip:
.. code-block:: bash
$ pip install --upgrade django-celery-beat
Downloading and installing from source
Download the latest version of django-celery-beat from
http://pypi.python.org/pypi/django-celery-beat
After installation, add django_celery_beat to Django's settings module:
.. code-block:: Python
INSTALLED_APPS = [
...,
'django_celery_beat',
]
Run the django_celery_beat migrations using:
.. code-block:: bash
$ python manage.py migrate django_celery_beat
Using the development version
With pip
You can install the latest main version of django-celery-beat using the following
pip command:
.. code-block:: bash
$ pip install git+https://github.com/celery/django-celery-beat#egg=django-celery-beat
Developing django-celery-beat
-----------------------------
To spin up a local development copy of django-celery-beat with Django admin at http://127.0.0.1:58000/admin/ run:
.. code-block:: bash
$ docker-compose up --build
Log-in as user ``admin`` with password ``admin``.
TZ Awareness:
-------------
If you have a project that is time zone naive, you can set ``DJANGO_CELERY_BEAT_TZ_AWARE=False`` in your settings file.
.. |build-status| image:: https://github.com/celery/django-celery-beat/actions/workflows/test.yml/badge.svg
:alt: Build status
:target: https://github.com/celery/django-celery-beat/actions/workflows/test.yml
.. |coverage| image:: https://codecov.io/github/celery/django-celery-beat/coverage.svg?branch=main
:target: https://codecov.io/github/celery/django-celery-beat?branch=main
.. |license| image:: https://img.shields.io/pypi/l/django-celery-beat.svg#foo
:alt: BSD License
:target: https://opensource.org/licenses/BSD-3-Clause
.. |pyversion| image:: https://img.shields.io/pypi/pyversions/django-celery-beat.svg#foo
:alt: Supported Python versions.
:target: http://pypi.python.org/pypi/django-celery-beat/
.. |pyimp| image:: https://img.shields.io/pypi/implementation/django-celery-beat.svg#foo
:alt: Support Python implementations.
:target: http://pypi.python.org/pypi/django-celery-beat/
.. |deepwiki| image:: https://devin.ai/assets/deepwiki-badge.png
:alt: Ask http://DeepWiki.com
:target: https://deepwiki.com/celery/django-celery-beat
:width: 125px
django-celery-beat as part of the Tidelift Subscription
-------------------------------------------------------
The maintainers of django-celery-beat and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. `Learn more`_.
.. _Learn more: https://tidelift.com/subscription/pkg/pypi-django-celery-beat?utm_source=pypi-django-celery-beat&utm_medium=referral&utm_campaign=readme&utm_term=repo
Does celery/django-celery-beat have a project website?
No homepage URL was recorded for celery/django-celery-beat in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Is celery/django-celery-beat open source?
TopGit's metadata for celery/django-celery-beat does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
What else is in the Backend space?
celery/django-celery-beat is tracked by TopGit under the Backend category, alongside 9 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is celery/django-celery-beat?
celery/django-celery-beat (celery/django-celery-beat) is a Python project on GitHub. From the project's own README: Celery Periodic Tasks backed by the Django ORM
Where do I read more about celery/django-celery-beat?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/celery/django-celery-beat is the definitive source.
Why is celery/django-celery-beat categorized under Backend?
TopGit places celery/django-celery-beat in the Backend category based on its GitHub topics and description (tagged: "celery", "celery-task", "celerybeat"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Is django-celery-beat worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of django-celery-beat.