I have some static location data to load so that it is available throughout the application like an in-memory cache.
I tried to override ready() on AppConfig but data isn't loaded from the database, also ready() is getting called twice.
from django.apps import AppConfig
class WebConfig(AppConfig):
name = 'useraccount'
verbose_name = 'User Accounts'
locations = []
def ready(self):
print("Initialising...")
location = self.get_model('Location')
all_locations = location.objects.all()
print(all_locations.count())
self.locations = list(all_locations)
any hints?