django项目 认证 用到
user = authenticate(username=username, password=password)
测试时发现 输入正确密码user返回为None 错误密码 也返回None
到数据库中 把is_active 改成 1 就能返回正确的user对象
否则返回None 并且报错
AttributeError: ‘NoneType’ object has no attribute ‘split’
**解决:**导致这个错误的原因是django自动关联了数据库的 is_active 好像django2.0向上才有的坑 只需到setting配置文件中 加入
AUTHENTICATION_BACKENDS = [‘django.contrib.auth.backends.AllowAllUsersModelBackend’]