0Pricing
Django Academy · Lesson

Scheduled Jobs with Celery Beat

Run periodic tasks on a schedule.

Scheduled Jobs with Celery Beat is a free Django Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Django Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Beyond One-Off Tasks

So far tasks run when you queue them. But some jobs should run on a clock: nightly reports, hourly cleanups, weekly digests. That is where Beat comes in. ⏰

What Celery Beat Is

Celery Beat is a scheduler. It is a separate process that wakes up on time and drops scheduled tasks onto the same queue your workers read.

Beat Plus Worker

Beat only queues jobs on schedule; it never runs them itself. You still need a worker running to actually execute what Beat enqueues.

Install the Scheduler

The django-celery-beat package stores your schedule in the database, so you can even edit it from the admin later. Install it first.

pip install django-celery-beat

Define a Beat Schedule

In settings, CELERY_BEAT_SCHEDULE is a dict mapping a name to a task path and how often to run it.

CELERY_BEAT_SCHEDULE = {
    "daily-report": {
        "task": "reports.tasks.send_report",
        "schedule": 86400.0,
    },
}

Intervals in Seconds

A plain number means "every N seconds". So 86400.0 is once a day and 3600.0 is once an hour. Simple, but a bit rigid for real calendars.

Crontab for Real Calendars

For "8am every Monday" use a crontab schedule. It reads like a cron line and handles days, hours, and minutes precisely.

from celery.schedules import crontab
schedule = crontab(hour=8, minute=0, day_of_week=1)

Wire Crontab In

Drop a crontab object straight into the schedule value to control exactly when a task fires.

"weekly-digest": {
    "task": "news.tasks.digest",
    "schedule": crontab(hour=8, minute=0, day_of_week="mon"),
}

Run the Beat Process

Start Beat in its own terminal, beside the worker. Now you have three processes: web server, worker, and the beat scheduler.

celery -A myproject beat -l info

Avoid Duplicate Beats

Run only one Beat process. Two schedulers means every job fires twice, which can double-send emails or double-bill users. 🚫

Edit Schedules from Admin

With django-celery-beat, schedules live in the database, so non-developers can add or pause periodic tasks right from the Django admin.

Quick Check

What is the relationship between Celery Beat and the worker?

Recap: Scheduled Jobs

Celery Beat queues tasks on a schedule using intervals or crontab. Run exactly one Beat plus a worker, and edit schedules from the admin. 🗓️

Frequently asked questions

Is the “Scheduled Jobs with Celery Beat” lesson free?

Yes — the full text of “Scheduled Jobs with Celery Beat” is free to read here on the web, and the Django Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Django Academy course, upgrade to CoddyKit PRO.

What will I learn in “Scheduled Jobs with Celery Beat”?

Run periodic tasks on a schedule. You practise Django Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Django Academy?

No prior experience is required. Django Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Scheduled Jobs with Celery Beat” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Django Academy lesson?

Yes. Every Django Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Why You Need Background Tasks
  2. Setting Up Celery with a Broker
  3. Writing and Calling @shared_task
  4. Scheduled Jobs with Celery Beat
← Back to Django Academy