1👍
✅
In settings.py
Add myapp
in INSTALLED_APPS
INSTALLED_APPS = [
...,
'myapp',
]
I User
model add app_label = ‘myapp’ like
class User(AbstractBaseUser):
id = models.CharField(max_length=15, null=False, blank=False, primary_key=True, unique=True)
USERNAME_FIELD = "id"
class Meta:
app_label = 'myapp'
If you want to move the model in a separate file. The directory structure should like
myapp
models
__init__.py
user.py
Put User model code in user.py
Then import User
model in __init__.py
from myapp.models.user import User
__all__ = ["User"]
Source:stackexchange.com