I got this following error while running the python outside of the usual manage.py commands.
CODE:
fromapp.modelsimport Bank
banks_queryset = Bank.objects.all()
# Convert the queryset to a list banks_list =list(banks_queryset)
print(banks_list[0])
SOLUTION:
If you are running the python outside of the usual manage.py. you need to configure the environment variable "DJANGO_SETTING_MODULE". you can set it in your script before accessing the model.