python - 发生异常:配置不当
问题描述
尝试调试代码时出现此错误:
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
错误停止我的代码是这样的:
解决方案
你从错误的地方开始你的应用程序,你的起点应该是 manage.py,vscode 的默认行为是你在你的 case views.py 中的当前文件
推荐阅读
- laravel - Laravel - 不正确的表定义;只能有一个自动列,并且必须将其定义为键”
- python - 网格倒角(顶点,面)
- go - 有什么方法可以使用自定义查询进行预加载
- laravel - 如何在 Laravel 查询生成器中计算“位置”匹配记录
- reactjs - 需要部署一个与 rasa 模型集成的 React Web 应用程序
- r - Shint:如何显示在 for 循环中更新的文本?
- python-3.x - 时间序列分解:ValueError: You must specify a period or x must be a pandas object with a DatetimeIndex with a freq not set to None
- javascript - 反应中的对象克隆
- python - PyOpenCl 无效的内核参数
- java - 返回的文件不为空,但在下次调用时为空