“django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet” when trying to load data into my model

前端 未结 1 1915
予麋鹿
予麋鹿 2020-12-22 10:52

I am developing an app in Django.

I want to load data inside my model, that is glossary_entry, but the data is stored inside an xlsx file, that is

相关标签:
1条回答
  • 2020-12-22 11:22

    I solved the problem by substituting the first code block I showed in the first queston with this piece below:

    import pandas as pd
    from myapp.models import glossary_entry
    
    def pour_entire_entry_model():
    
        elements = glossary_entry.objects.all() 
    
        for element in elements:
    
            entry = acquired_terminology.objects.create()
    
            entry.Lemma = element.Lemma
            entry.Acronym = element.Acronym
            entry.Definizione = element.Definizione 
    
                # creates a tuple of the new object or
                # current object and a boolean of if it was created
    
    0 讨论(0)
提交回复
热议问题