Django Serverless Cron
Project description
Django Serverless Cron
Documentation
The full documentation is at https://django-serverless-cron.readthedocs.io.
Features
Run cron jobs easily in a serverless environment.
Quickstart
Installation
Install Django Serverless Cron:
pip install django-serverless-cron
Settings
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
# ...
'django_serverless_cron'
# ...
)
Add Django Serverless Cron’s cron jobs to your settings file:
CRONJOBS = [
# (
# '1_hours', # frequency (days, minutes, hours, weeks) -> in this case, every one hour
# 'mail.jobs.send_mail_function', # path to task/function functions -> in this case, send_mail_function()
# {'kwarg1': 'foo'} # kwargs passed to the function
# ),
(
'1_day',
'your_app.services.your_job_function',
{'kwarg1': 'foo', 'kwarg2': 'bar'}
),
(
'1_hour',
'mail.jobs.send_mail_function',
{"is_bulk": True}
),
]
URL patterns
Add the jobs to your URL patterns:
from django_serverless_cron import urls as django_serverless_cron_urls
urlpatterns = [
# ...
url(r'^', include(django_serverless_cron_urls))
#...
]
Running Jobs
Running via the view/API
Call the /run path to run all jobs:
curl http://localhost:8000/run
or
import requests
x = requests.get('http://localhost:8000/run')
Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
Development commands
pip install -r requirements_dev.txt invoke -l
Credits
Tools used in rendering this package:
History
0.1.0 (2022-01-27)
First release on PyPI.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for django_serverless_cron-0.1.1a6-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c810780f5f1594636171e2c9472405cb06a2894dc71b13e9678d0d924adf23bc |
|
MD5 | 2fd938f1be3665da716d95d7ca1a990e |
|
BLAKE2b-256 | 16797a381036e3fbad9bc96ebd85a0c62e680273bd3964305bd6fee94913f951 |