django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment varia

前端 未结 8 1846
遇见更好的自我
遇见更好的自我 2020-12-28 14:46

I\'ve tried everything that I could find to fix this issue, and I\'m starting to tear my hair out a little. I\'m getting this error:

django.core.exceptions.I         


        
相关标签:
8条回答
  • 2020-12-28 15:17

    If you're using PyCharm you may have forgotten to choose your debug configuration here:

    0 讨论(0)
  • 2020-12-28 15:20

    In your python script, you are trying to access Django models before setting the environment try it in this order :

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<appname>.`settings`")
    from <appname>.models import Class1, Class2,...
    
    0 讨论(0)
提交回复
热议问题