Asking for some help on this one.
def home(request):
client = pymongo.MongoClient(settings.MONGO_SERVER)
main_db = client[settings.MONGO_DATABASE]
get_main_config = main_db.configurations.find_one({"name": "main_config"})
return render(request, 'dashboard/home.html', {"data": get_main_config["homepage_urls"]})
Traceback (most recent call last):
render(request, 'dashboard/home.html', {"data": get_main_config["homepage_urls"]})
TypeError: 'NoneType' object is not subscriptable
Why the error occured on that line? Thank you.
get_main_configisNone. Are you sure thatmain_db.configurations_find_onedoesn't ever returnNone?