【发布时间】:2017-08-18 06:55:06
【问题描述】:
我们知道,Django-Cookiecutter 对设置文件有不同的设置。常规的 from 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.
【问题讨论】:
标签: django cookiecutter-django