我正在嘗試在Django中檢索頂級投票項目。以下是相關的代碼行:django投票中的錯誤?
originalList = [x[0] for x in list(Vote.objects.get_top(Item, endIdx))[startIdx:]]
這些索引是用於分頁的目的。當我嘗試在瀏覽器中加載頁面時,我得到:
AttributeError at /items/top/
'Settings' object has no attribute 'DATABASE_ENGINE'
然而,應該尋找的屬性不DATABASE_ENGINE,相反,它是在DATABASES['default']['ENGINE']
。這怎麼解決?