gpt4 book ai didi

python - Django 3.2 异常 : django. core.exceptions.ImproperlyConfigured

转载 作者:行者123 更新时间:2023-12-03 22:54:34 25 4
gpt4 key购买 nike

我正在升级到 django 3.2,但根据它的发行说明,它说:

The SECRET_KEY setting is now checked for a valid value upon firstaccess, rather than when settings are first loaded. This enablesrunning management commands that do not rely on the SECRET_KEY withoutneeding to provide a value. As a consequence of this, callingconfigure() without providing a valid SECRET_KEY, and then going on toaccess settings.SECRET_KEY will now raise an ImproperlyConfiguredexception.


错误: django.core.exceptions.ImproperlyConfigured: Cannot import 'users'. Check that 'apps.users.apps.UsersConfig.name' is correct.用户apps.py:
from django.apps import AppConfig

class UsersConfig(AppConfig):
name = 'users'
我认为该错误是因为它与 django==3.1.7 一起使用。有人可以帮我解决这个问题吗?如何检查我的 key 是否有效,并在需要时生成新 key ?

最佳答案

我认为您的错误与 SECRET_KEY 没有直接关系改变你的问题。
AppConfig.name 应该是应用程序的完整 Python 路径。因为你似乎有 usersapps 内模块,你应该使用 'apps.users'而不是 'users'

class UsersConfig(AppConfig):
name = 'apps.users'

关于python - Django 3.2 异常 : django. core.exceptions.ImproperlyConfigured,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67056517/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com