Django model “doesn't declare an explicit app_label”

后端 未结 28 1925
無奈伤痛
無奈伤痛 2020-11-27 15:38

I\'m at wit\'s end. After a dozen hours of troubleshooting, probably more, I thought I was finally in business, but then I got:

Model class django.contrib.co         


        
28条回答
  •  暖寄归人
    2020-11-27 15:57

    After keep on running into this issue and keep on coming back to this question I thought I'd share what my problem was.

    Everything that @Xeberdee is correct so follow that and see if that solves the issue, if not this was my issue:

    In my apps.py this is what I had:

    class AlgoExplainedConfig(AppConfig):
        name = 'algo_explained'
        verbose_name = "Explain_Algo"
        ....
    

    And all I did was I added the project name in front of my app name like this:

    class AlgoExplainedConfig(AppConfig):
    name = '**algorithms_explained**.algo_explained'
    verbose_name = "Explain_Algo"
    

    and that solved my problem and I was able to run the makemigrations and migrate command after that! good luck

提交回复
热议问题