Django Authenticate returns None

In settings.py, add

AUTH_USER_MODEL = your custom user class

e.g if django app name is office and custom user class is Account then

AUTH_USER_MODEL = 'office.Account'

Put something like this in your settings

#Authentication backends
AUTHENTICATION_BACKENDS = (
        'django.contrib.auth.backends.ModelBackend',
    )

or if you are using userena for your accounts

#Authentication backends
AUTHENTICATION_BACKENDS = (
    'userena.backends.UserenaAuthenticationBackend',
    'guardian.backends.ObjectPermissionBackend',
    'django.contrib.auth.backends.ModelBackend',
)

Why don't you create a user like this:

user = User.objects.create_user( username="whatever", email="[email protected]", password="password")
user = authenticate( username="whatever",password="password")

Interestingly enough, check_password returns True in the following:

eml = "[email protected]"
pw = "pass"
uname = 'w2'
user = User.objects.create_user(uname,eml,pw)
user.save()
log.debug("Password check passes?")
log.debug(user.check_password(pw)) # Logs True!!!
user = authenticate(username=uname, password=pw)