I would like to have a global variable in my django application that stores the resulting list of objects that I later use in some functions, and I do not want to evaluate the request in more detail again, I do it like this:
from app.models import StopWord
a = list(StopWord.objects.values_list('word', flat=True))
...
def some_func():
... (using a variable) ...
It seems to me that this is normal, but the problem is that the syncdb and test command throws an exception:
django.db.utils.DatabaseError: (1146, "Table 'app_stopword' doesn't exist")
I do not know how to get rid of this, maybe I'm wrong?
source
share