mardi 3 novembre 2020

How to invoke a function continuously in Flask?

I and my team are building a website which helps people to create and manipulate their todo list (with Python, Flask and MySQL). We have done all of the core functions and major contents. However, our website has a feature which is sending email to remind people about their incoming tasks. We'll send them an email when there's only 1 day left until their due date and an email 1 hour before the due time comes. We wrote a function calculating the time to check if it's 1 day or 1 hour left and this func works effectively. However, there's a problem as we have to always run this func so it can check the time if the task has only 1 day or 1 hour left. We have a page which contains a link, we click this link and it will run the func. Currently, we can not make the func runs continuously, but we have to refresh the page and click the link to make the func run 1 time. Theoretically, we can stay online and do the same work which is refresh the page and click the link forever:))) It's impossible so I wonder if there is a way to do this automatically (i thought about Selenium first however i thought it's quite complicated). Or if there is another way to do this in Flask instead of making a page with a link inside would be great too.




Aucun commentaire:

Enregistrer un commentaire