Django model “doesn't declare an explicit app_label”

后端 未结 28 1908
無奈伤痛
無奈伤痛 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 16:07

    I had exactly the same error when running tests with PyCharm. I've fixed it by explicitly setting DJANGO_SETTINGS_MODULE environment variable. If you're using PyCharm, just hit Edit Configurations button and choose Environment Variables.

    Set the variable to your_project_name.settings and that should fix the thing.

    It seems like this error occurs, because PyCharm runs tests with its own manage.py.

提交回复
热议问题