I want to initialize some variables (from the database) when starting Django.
I can get data from the database, but the problem is how should I call the initialize method. And it needs to be called only once.
I tried to search for other pages, but could not find an answer to it.
Currently, the code looks something like this:
def get_latest_dbx (request, ....):
#get data from the database
def get_latest_x (request):
get_latest_dbx (request, x, ...)
def startup (request):
get_latest_x (request)
source
share