You might have a model like this to store the integer counter in the database:
class Counter(models.Model):
counter_value = models.IntegerField()
Then you can create an instance of this model and give it an initial value of 0 using Django shell: Enter the shell by running python manage.py shell, then run the following after importing the Counter model:
Counter.objects.create(counter_value=0)
Then create a view that increments the counter (after importing your Counter model):
def increment(request):
counter = Counter.objects.get(pk=1)
counter.counter_value += 1
counter.save()
Then create a url for this view (after importing the corresponding views):
urlpatterns = [
# ...
url(r'^increment-counter/', views.increment)
]
Now, you can run a simple Python script on the server to request the url above and cause the counter to increment every one hour for example. The script may look like this:
import time
import requests
while True:
request.get('http://your-website-url/increment-counter')
time.sleep(60*60) # 1 hour
This requires that you have the requests package installed.
After that, you can run this script on your server (python3 /path/to/script) to achieve what you wanted.
I kept it simple. You can, however, add complexity to satisfy your needs. You can also make the Python script run when the system starts, and you can add more functionality to it.
Note: I haven't tested the code above, but I think it is simple and works as expected.