I hereby claim:
- I am juanwolf on github.
- I am juanwolf (https://keybase.io/juanwolf) on keybase.
- I have a public key ASCnr_rBGYD278iJnxFTkYYhzLHJaQeLxDgxFR7KUBYWgwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Code adapted for django 1.10 and python3 from https://stackoverflow.com/a/19249559/2622605 | |
from django.http import HttpResponse | |
import json | |
class NonHtmlDebugToolbarMiddleware: | |
""" | |
The Django Debug Toolbar usually only works for views that return HTML. | |
This middleware wraps any non-HTML response in HTML if the request |
crontab = settings.CELERYBEAT_SCHEDULE['mytask']['schedule'] | |
# We get the duration until the next execution | |
delta = crontab.remaining_estimate(crontab.now()) | |
# We get the datetime of the next execution | |
next_exec = datetime.now() + delta | |
# We get the duration between two execution | |
duration = crontab.remaining_estimate(next_exec) - delta | |
# So the last run is the next_exec minus the duration between two task. | |
last_run = next_exec - duration |