Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ed55844
Deprecation warning and link to dj rest auth
Nov 2, 2021
fdb41bd
command to run certain CronJobs repetitively
nerjan Nov 22, 2021
67575df
tests for cronloop
nerjan Nov 22, 2021
4f58228
name locks by modulename.class_name for higher distinction
nerjan Nov 23, 2021
8c40f5e
documentation
nerjan Nov 26, 2021
ceda4de
Remove misleading link from deprecation notice
weslord Feb 24, 2022
40e7be0
Merge pull request #189 from weslord/patch-1
JedrzejMaluszczak May 5, 2022
fe252dc
django 4.0 fixes (#186)
xzzy May 5, 2022
5b0ba67
Merge pull request #180 from Tivix/nerjan/cronloop_command
JedrzejMaluszczak May 6, 2022
3d79aa8
assertIn take string as 1st agrument (#182)
nerjan May 6, 2022
c439c6a
Run CronJobs on days in month/ monthly (#183)
nerjan May 6, 2022
70d8ba6
Merge pull request #184 from Tivix/nerjan/change_lock_naming_to_modul…
JedrzejMaluszczak May 6, 2022
c0bbe43
Locking backend with database (#185)
nerjan May 9, 2022
1749972
Replace deprecated send_mail function, remove depricated requirements
JedrzejMaluszczak May 30, 2022
5bf683c
Demo App -a dd another example
JedrzejMaluszczak May 30, 2022
9053401
Reformact code with black --skip-string-normalization
JedrzejMaluszczak May 30, 2022
648e251
fix tests
JedrzejMaluszczak May 30, 2022
b395b9a
Create django.yml
JedrzejMaluszczak May 30, 2022
75d16d8
Fix failing test
JedrzejMaluszczak May 30, 2022
46eb78f
Update django.yml
JedrzejMaluszczak May 30, 2022
5b57171
Update requirements and setup.py
JedrzejMaluszczak May 30, 2022
0da62f6
Update docs/sample_cron_configurations and package version
JedrzejMaluszczak May 30, 2022
f3f9991
DOCS/ Remove the notice in the readme that the project is deprecated
JedrzejMaluszczak May 30, 2022
2c8c0f7
DOCS/ update changelog
JedrzejMaluszczak May 30, 2022
3dfce36
Reanme run_on_days to run_weekly_on_days
JedrzejMaluszczak May 30, 2022
120d3a6
DOCS/ sample cron configurations update
JedrzejMaluszczak May 30, 2022
657e134
DOCS/ link to a demo app, docs improvments
JedrzejMaluszczak May 30, 2022
c99986e
Enabling Duration Sorting in Admin
JedrzejMaluszczak May 30, 2022
a99550c
Fix for issue #99. Cronjob is run every time runcrons is called
JedrzejMaluszczak May 30, 2022
84a1a30
Move django_cron/__init__.py code to helper.py and core.py
JedrzejMaluszczak May 30, 2022
2c06788
Add run time tolerance parameter to Schedule
JedrzejMaluszczak May 30, 2022
b49aa24
Add documentation for Schedule.run_tolerance_seconds
JedrzejMaluszczak May 30, 2022
2855270
test - remove unnecessary db queries
JedrzejMaluszczak May 30, 2022
3ef1f78
Fix/ run tolerance
JedrzejMaluszczak May 30, 2022
f53f5e5
Issue #104 - remove succeeded cron job logs
JedrzejMaluszczak May 31, 2022
782a43e
Issue #104 - remove succeeded jon logs - tests
JedrzejMaluszczak May 31, 2022
7e0a66f
Issue #104 - docs
JedrzejMaluszczak May 31, 2022
9dd28ce
Merge pull request #213 from Tivix/Remove-succeed-cron-job-logs
JedrzejMaluszczak May 31, 2022
def65f0
Issue/#80 filter/ignore jobs with future dates
JedrzejMaluszczak May 31, 2022
607befe
issue/#80 tests
JedrzejMaluszczak May 31, 2022
db653a2
Merge pull request #214 from Tivix/issue/80-exclude-future-dates-from…
JedrzejMaluszczak May 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Django CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Install Test Dependencies
run: |
pip install -r test_requirements.txt
- name: Run Tests
run: |
python runtests.py runtests
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
install:
- pip install -q Django==$DJANGO
- pip install coveralls
- pip install -r test_requirements.pip
- pip install -r test_requirements.txt
script:
- flake8 . --config=flake8
- coverage run --source=django_cron setup.py test
Expand Down
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ Documentation
http://django-cron.readthedocs.org/en/latest/

This open-source app is brought to you by Tivix, Inc. ( http://tivix.com/ )

Demo App
=============

https://github.com/Tivix/django-crone-demo
27 changes: 22 additions & 5 deletions demo/demo/cron.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import datetime

from django.conf import settings
from django.contrib.auth.models import User
from django.core.mail import send_mail

from django_common.helper import send_mail
from django_cron import CronJobBase, Schedule


class EmailUsercountCronJob(CronJobBase):
class EmailUserCountCronJob(CronJobBase):
"""
Send an email with the user count.
"""
RUN_EVERY_MINS = 0 if settings.DEBUG else 360 # 6 hours when not DEBUG

RUN_EVERY_MINS = 0 if settings.DEBUG else 360 # 6 hours when not DEBUG

schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
code = 'cron.EmailUsercountCronJob'
code = 'cron.EmailUserCountCronJob'

def do(self):
message = 'Active users: %d' % User.objects.count()
Expand All @@ -21,5 +24,19 @@ def do(self):
'[django-cron demo] Active user count',
message,
'[email protected]',
['[email protected]']
['[email protected]'],
)


class WriteDateToFileCronJob(CronJobBase):
"""
Write current date to file.
"""

schedule = Schedule(run_at_times=["12:20", "12:25"], retry_after_failure_mins=1)
code = 'cron.WriteDateToFileCronJob'

def do(self):
message = f"Current date: {datetime.datetime.now()} \n"
with open("cron-demo.txt", "w") as myfile:
myfile.write(message)
9 changes: 5 additions & 4 deletions demo/demo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

'django_cron'
'django_cron',
]

MIDDLEWARE = [
Expand All @@ -47,7 +46,6 @@
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
Expand Down Expand Up @@ -125,5 +123,8 @@
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

CRON_CLASSES = [
"demo.cron.EmailUsercountCronJob",
"demo.cron.EmailUserCountCronJob",
"demo.cron.WriteDateToFileCronJob",
]
# If you want to test django locking with database
# DJANGO_CRON_LOCK_BACKEND = "django_cron.backends.lock.database.DatabaseLock"
4 changes: 2 additions & 2 deletions demo/demo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
2. Import the include() function: from django.conf.urls import url, include
3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import url
from django.contrib import admin
from django.urls import re_path

urlpatterns = [
url(r'^admin/', admin.site.urls),
re_path(r'^admin/', admin.site.urls),
]
3 changes: 1 addition & 2 deletions demo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Django==2.2.20
django-common-helpers>=0.7,<0.7.99
Django==4.0.4
-e ../
Loading