Skip to main content

A Django app to manage cron jobs.

Project description

DJANGO CRON COMMAND

Installation

pip install django-cron-command

Initialization

  1. Add cron_command to your INSTALLED_APPS in settings.py
INSTALLED_APPS = [
    ...
    'cron_command',
]
  1. Create command/task
your_app/management/commands/my_custom_command.py
from django.core.management.base import BaseCommand

class Command(BaseCommand):
    help = 'Manage cron jobs'

    def add_arguments(self, parser):
        # add sub task

    def handle(self, *args, **options):
        # main task
  1. Define your cron jobs in settings.py
CRON_JOBS = {
    'job1': {
        'schedule': '0 0 * * *',
        'command': 'my_custom_command'
    },
    'job2': {
        'schedule': '*/5 * * * *',
        'command': 'another_custom_command'
    },
    'job3': {
        'schedule': '*/5 * * * *',
        'command': 'another_custom_command run'
    }
}
  1. Add cron
python manage.py cron_add
  1. Check status
python manage.py cron_list
  1. Remove cron
python manage.py cron_remove

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_cron_command-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

django_cron_command-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file django_cron_command-0.1.0.tar.gz.

File metadata

  • Download URL: django_cron_command-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for django_cron_command-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0ee1fa71d4044f3d6e2746048610ec129ef55c59721444cd08355c6c01391b52
MD5 5e952585f9e87d38c4216bff03b6b47c
BLAKE2b-256 c9df489477658c596e64210c96f6e68d9d3abe7a9dbb8d8e81cc6c2203ba8e08

See more details on using hashes here.

File details

Details for the file django_cron_command-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_cron_command-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d295c9b8ee2e13cd7cc7af0da7d3a58c26a10634bbecfb2aa3c7ece6511b6bc
MD5 e7ba679b331b3817f5073e77906f7d9f
BLAKE2b-256 cbc1bc4a0c95b276bee0112a2df922d69020221e5f4f600e7e53fe5f0cc9dbcc

See more details on using hashes here.

Supported by

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