A Django app to manage cron jobs.
Project description
DJANGO CRON COMMAND
Installation
pip install django-cron-command
Initialization
- Add cron_command to your INSTALLED_APPS in settings.py
INSTALLED_APPS = [
...
'cron_command',
]
- 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
- 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'
}
}
- Add cron
python manage.py cron_add
- Check status
python manage.py cron_list
- Remove cron
python manage.py cron_remove
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ee1fa71d4044f3d6e2746048610ec129ef55c59721444cd08355c6c01391b52 |
|
MD5 | 5e952585f9e87d38c4216bff03b6b47c |
|
BLAKE2b-256 | c9df489477658c596e64210c96f6e68d9d3abe7a9dbb8d8e81cc6c2203ba8e08 |
File details
Details for the file django_cron_command-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_cron_command-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d295c9b8ee2e13cd7cc7af0da7d3a58c26a10634bbecfb2aa3c7ece6511b6bc |
|
MD5 | e7ba679b331b3817f5073e77906f7d9f |
|
BLAKE2b-256 | cbc1bc4a0c95b276bee0112a2df922d69020221e5f4f600e7e53fe5f0cc9dbcc |