Skip to main content

A Django app for running cron jobs with django-rq

Project description

django-rq-cron

A Django app for running cron jobs with django-rq.

Installation

pip install django-rq-cron

Add to INSTALLED_APPS in your Django settings:

INSTALLED_APPS = [
    # ...
    'django_rq',
    'django_rq_cron',
]

Configure RQ_QUEUES in your settings:

RQ_QUEUES = {
    'default': {
        'URL': 'redis://localhost:6379/0',
        'DEFAULT_TIMEOUT': 360,
    },
}

Run migrations:

python manage.py migrate

Usage

Create a cron job by defining a function with the @register_cron decorator:

from django_rq_cron.registry import register_cron
from django_rq_cron.models import CronJob

@register_cron(
    description="My daily task",
    cadence=CronJob.Cadence.DAILY,
    queue="default"  # Optional, defaults to "default"
)
def my_daily_task():
    # Task implementation
    pass

The package will automatically discover cron jobs in a 'crons' module in each installed app.

Bootstrap cron jobs with the management command:

python manage.py bootstrap_cron_jobs

Features

  • Schedule jobs to run at different cadences (every minute, every 10 minutes, hourly, daily, weekly, monthly)
  • Track job execution status in the database
  • View job history and results in the Django admin
  • Built-in jobs for cleanup and system health checks

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_rq_cron-0.1.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_rq_cron-0.1.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file django_rq_cron-0.1.1.tar.gz.

File metadata

  • Download URL: django_rq_cron-0.1.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for django_rq_cron-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6ec3844b5775e216d91909a0fc239923a6fce98795cc0cf074a21d6df3050663
MD5 a0d18b992de0a9bcfe43e96553b0be59
BLAKE2b-256 79ccdbb503025c896882a2e4bd5bf6d3500a1c8e4125bbeba6e625ce356349d9

See more details on using hashes here.

File details

Details for the file django_rq_cron-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_rq_cron-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8deb046ebc6d2cf204ef35ea03a541d34df87d7b6fb5509772e0ba549395a38
MD5 71229ca82b29fb6a05785ec4ac18b617
BLAKE2b-256 f1365ce0cb35109f76acb04116b7148e8bc03d7d853391e36d3f9d54ff2782dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page