2

In a flask application I read a list of json values from a DB and keep it in memory for all views:

__init__.py
...
items = <load some stuff from remote API RESTDB>
...

In my views I import this variable:

someview.py
from project import items
...

My question is: How can I refresh this global var from time to time?

e.g. I want to refresh it when the application in a view writes to the RESTDB (thus changing the list of items).

Suh Fangmbeng
  • 573
  • 4
  • 16
caliph
  • 1,389
  • 3
  • 27
  • 52

0 Answers0