Skip to main content

django-cronjobs is a simple Django app that runs registered cron jobs via a management command.

Installing

To install django-cronjobs, first install via pip or easy_install, then just add cronjobs to your INSTALLED_APPS.

Registering a cron job

django-cronjobs includes a decorator to register a cronjob, and discovers registered jobs in the module <appname>.cron.

For example:

# myapp/cron.py
import cronjobs

@cronjobs.register
def periodic_task():
    pass

django-cronjobs will then recognize periodic_task as a valid job.

Running a cron job

To run a registered cron job, use the cron management command:

$ ./manage.py cron <job_name>

So to run periodic_task from above, you could use:

$ ./manage.py cron periodic_task

Additional arguments can be passed after the name of the task.

Locks

By default, cron jobs are locked so that only one copy of a given job can be running at a time. If you need to override this behavior, you can pass the lock kwarg to register:

from cronjobs import register
@register(lock=False)
def my_cron_job():
    # Multiple instances of me can run simultaneously.

If you run multiple sets of cronjobs on the same file system and need the locks to not collide, set CRONJOB_LOCK_PREFIX to something unique in your Django settings.

Release files for django-cronjobs 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-cronjobs 0.2.3
File Size Uploaded
django-cronjobs-0.2.3.tar.gz 3.9 kB Details

Release files / django-cronjobs-0.2.3.tar.gz

Download URL django-cronjobs-0.2.3.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
177295b1442400c92cdb67e8e18f9ff5946fb442f85813b9d0837823722ea08d
BLAKE2b-256 checksum
How to use checksums
d78ef73213675e7953ffdee57b3b94014b21590a838de528dfc502c2509cd49e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page