【问题标题】:django core exceptions ImproperlyConfigured:django 核心异常配置不当:
【发布时间】:2022-12-07 15:53:46
【问题描述】:

我昨晚午夜左右启动并运行了我的 django,当我关闭时一切都是卡瓦,但在早上当我打开我的电脑时我得到 django.core.exceptions.ImproperlyConfigured: error

!错误

Note that only Django core commands are listed as settings are not properly configured (error: 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.).

我尝试关闭 VScode 和终端,重新打开它们,再次启动虚拟环境,但错误仍然存​​在

\env\Scripts\python.exe: No module named django

我在虚拟环境中安装了 django 并设置为全局环境变量 提前致谢

我希望 python 能够在虚拟环境中安装 django

【问题讨论】:

  • 显然你还没有在 virtualenv 上安装 Django。尝试 \env\scripts\python.exe -m pip freeze 并确认是否列出了 Django。

标签: django django-rest-framework environment-variables virtualenv django-settings


【解决方案1】:

您能否分享您的 virtualenv 中存在的具有指定版本的模块。 您可以输入 pip freeze 来查看。

最新的 django 版本 4.0.2 与少数 Python 版本存在兼容性问题。

如果问题仍然存在,请回复此消息。

【讨论】:

    猜你喜欢
    • 2014-11-12
    • 1970-01-01
    • 1970-01-01
    • 2018-06-04
    • 2014-01-31
    • 1970-01-01
    • 1970-01-01
    • 2021-11-17
    • 2011-10-01
    相关资源
    最近更新 更多