Article
Scheduled content in Django: Celery Beat in practice
How I built a system that publishes posts automatically at a scheduled time with Celery Beat — architecture, code and pitfalls.

Many CMSs have a "publish later" feature. Building it from scratch in Django takes three components:
1. A status field
status = models.CharField(choices=[draft, scheduled, published, archived]) publish_at = models.DateTimeField(null=True)
2. A Beat task
Every 60 seconds we find posts where status=scheduled AND publish_at <= now
and publish them.
3. Idempotency
The biggest pitfall: even if the task runs twice, the post must not be
distributed twice. Use get_or_create and a unique constraint.
Full code is on GitHub — reach out if you have questions!
- #Django
- #Nuxt 3