众所周知,Django-Cookiecutter 对设置文件有不同的设置。来自 django.conf的常规导入设置在这里不起作用。
我想引用设置目录下base.py 文件中定义的自定义用户模型。有任何想法吗?
下面是我的项目布局:
repository/
config/
settings/
__init__.py
base.py # where the auth_user_model variable is defined
local.py
production.py
test.py
app_dir/
users/
__init__.py
models.py # where the custom user model is stored
我还尝试直接从 users/models.py 导入自定义用户模型,如下所示:
from users.models import User
但出现以下错误:
RuntimeError: Model class users.models.User doesn't declare an
explicit app_label and isn't in an application in INSTALLED_APPS.