1 Pycharm debug报错

0. IDE开发环境

  • PyCharm 任意社区版

    1. 错误信息
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, 
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: Requested setting INSTALLED_APPS, but settings are not_python

3. 产生报错的可能原因

  • 项目名称更改导致python解释器找不到
  • 激活虚拟环境时导入之前的工作目录,导致debug找不到解释器。
  • 开启了pac模式等

2.解决方案:

更改debug设置:文件 -> settings -> Python Debugger -> PyQt兼容 -> PyQt5 -> Apply -> OK

django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not_虚拟环境_02