I'm working on a Django project using django-allauth and dj-rest-auth for authentication. I've set up a custom user model (CustomUser) where email is the USERNAME_FIELD and username is set to None. I'm consistently getting the following warning during system checks:
?: (account.W001) ACCOUNT_LOGIN_METHODS conflicts with ACCOUNT_SIGNUP_FIELDS
Despite trying various configurations for ACCOUNT_LOGIN_METHODS and ACCOUNT_SIGNUP_FIELDS in my settings.py, this warning persists. My application seems to work (login/registration via email), but I'd like to resolve this warning to ensure my configuration is correct. Here are the relevant parts of my setup: models.py (users app):
from django.contrib.auth.models import AbstractUser
from django.db import models
from .managers import CustomUserManager
class CustomUser(AbstractUser):
username = None
email = models.EmailField(unique=True)
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_superuser = models.BooleanField(default=False)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
objects = CustomUserManager()
def __str__(self):
return self.email
settings.py (relevant allauth/dj-rest-auth parts):
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES':(
'rest_framework_simplejwt.authentication.JWTAuthentication',
'dj_rest_auth.jwt_auth.JWTCookieAuthentication',
)
}
# dj-rest-auth
# authentication Backend
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
]
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_LOGIN_METHODS = {'email'}
ACCOUNT_SIGNUP_FIELDS = ['email','password']
ACCOUNT_EMAIL_VERIFICATION = 'none'
serializers.py:
from rest_framework import serializers
from .models import CustomUser
class RegisterSerializer(serializers.ModelSerializer):
password = serializers.CharField(write_only=True)
password2 = serializers.CharField(write_only=True, label="Confirm Password")
class Meta:
model = CustomUser
fields = ['email', 'first_name', 'last_name','password', 'password2']
def validate(self, attrs):
if attrs['password'] != attrs['password2']:
raise serializers.ValidationError({"password": "Your passwords didn't match."})
return attrs
def create(self, validated_data):
validated_data.pop('password2')
user = CustomUser.objects.create_user(**validated_data)
return user
Full Warning Output :
/home/roni/Desktop/FitCore/env/lib/python3.12/site-packages/dj_rest_auth/registration/serializers.py:228: UserWarning: app_settings.USERNAME_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['username']['required']
required=allauth_account_settings.USERNAME_REQUIRED,
/home/roni/Desktop/FitCore/env/lib/python3.12/site-packages/dj_rest_auth/registration/serializers.py:230: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required']
email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)
/home/roni/Desktop/FitCore/env/lib/python3.12/site-packages/dj_rest_auth/registration/serializers.py:288: UserWarning: app_settings.EMAIL_REQUIRED is deprecated, use: app_settings.SIGNUP_FIELDS['email']['required']
email = serializers.EmailField(required=allauth_account_settings.EMAIL_REQUIRED)
System check identified some issues:
WARNINGS:
?: (account.W001) ACCOUNT_LOGIN_METHODS conflicts with ACCOUNT_SIGNUP_FIELDS
System check identified 1 issue (0 silenced).
May 28, 2025 - 16:33:56
Django version 5.2.1, using settings 'fitcore.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Django: 5.2.1 Python: 3.12.x django-allauth: 65.8.1 dj-rest-auth: 7.0.1 What I've tried specifically for the W001 warning: ACCOUNT_SIGNUP_FIELDS = ['email'] ACCOUNT_SIGNUP_FIELDS = ['email', 'password'] Ensured ACCOUNT_USER_MODEL_USERNAME_FIELD = None and ACCOUNT_LOGIN_METHODS = ('email',) are set. Ensured deprecated allauth settings are removed.
My Questions:
Any insights or suggestions would be greatly appreciated!
Your signup fields has email as optional, Make it required by using "email*"
:
ACCOUNT_SIGNUP_FIELDS = ["email*", "password*"]
See this similar issue and the docs.