I have a dockerized Flask application running locally that consists of several REST API endpoints. It's all working as expected so that when a GET request is performed on one of the endpoints, data is retrieved from the Postgres database and then displayed to the browser as json. Great. The database so far is just test data and now I need to continually update the database with real data.
I have the script that pulls data from the web, and I understand how to add it to the database with post and put requests, but what I don't understand, is how and where to have this script continually running, to where it doesn't interfere with the REST API portion of my server and vice versa, almost as though it's a completely separate entity within the backend.
To do this, would I create an entirely new flask app that runs on it's own server and is continually running the script and adding the scraped data to the database so that the other flask app which contains the API endpoints can access it when needed? I feel as though I am way off here, and any input on the best way to move forward is extremely appreciated. Thank you!