I am trying to learn how to scheduled a task in Django using schedule package. Here is the code I have added to my view. I should mention that I only have one view so I need to run scheduler in my index view.. I know there is a problem in code logic and it only render scheduler and would trap in the loop.. Can you tell me how can I use it?
def job():
    print "this is scheduled job", str(datetime.now())
def index(request):
    schedule.every(10).second.do(job())
    while True:
        schedule.run_pending()
        time.sleep(1)
    objs= objsdb.objects.all()
    template = loader.get_template('objtest/index.html')
    context= { 'objs': objs}
    return HttpResponse(template.render(context, request))
 
    