Requested setting DATABASES, but settings are not configured. You must either define the environment

  • Post author:
  • Post category:其他


1、Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

2、

django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.


解决办法:


在settings.py中加入下面代码

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "HeatEnergy.settings")



版权声明:本文为TionSu原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。