I am trying to display a number that will increment over time that is called from a very, very simple Django database. It will be called using jinja2 templating and the number is a simple IntegerField().
However, I would like for that number to autoincrement, live without refreshing the page, multiple times throughout the day. Also, I would like for every time that the number is refreshed, for the new value to be added to the same database recording the time and date. What is the best combo or group of languages/frameworks to achieve this?
I'm starting to think that Django and Jinja2 alone are not enough to achieve this effect.
Maybe this can help: Advanced Python Scheduler
Here's a small piece of code from their documentation to run every hour or configure as crontab:
from apscheduler.schedulers.blocking import BlockingScheduler
def some_job():
print "Decorated job"
scheduler = BlockingScheduler()
scheduler.add_job(some_job, 'interval', hours=1)
scheduler.start()
Without knowing more of your code it's difficult to say on incremenation but I can suggest
number += 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With