Django comes with a contributed django.contrib.auth app that's used for authentication. It allows users to log in with their username and password to be able to use administration features, for example. This app has been designed so that you can extend it with your own functionality. In this recipe, we will create a custom user and role models and will set administration for them. Instead of a username and password, you will be able to log in by email and password.
Creating a custom accounts app
Getting ready
Create an accounts app and put this app under INSTALLED_APPS, in the settings:
# myproject/apps/_base.py
INSTALLED_APPS = [
# …
"myproject.apps.accounts",
]