首页 > 解决方案 > 发生异常:配置不当

问题描述

尝试调试代码时出现此错误:

Exception has occurred: 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.
  File "C:\PyProjects\InstaDriver\users_app\views.py", line 2, in <module>
    from django.contrib.auth.forms import UserCreationForm

错误停止我的代码是这样的:

在此处输入图像描述

标签: pythondjango

解决方案


你从错误的地方开始你的应用程序,你的起点应该是 manage.py,vscode 的默认行为是你在你的 case views.py 中的当前文件


推荐阅读