Python ';用户';对象没有属性';已验证';

Python ';用户';对象没有属性';已验证';,python,django,Python,Django,我有这个错误。突然间,它在我的本地电脑上运行良好。但是当我尝试部署应用程序时,我遇到了这个错误,我使用了一个包two\u factorOtp,这是回溯 回溯: File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) Fi

我有这个错误。突然间,它在我的本地电脑上运行良好。但是当我尝试部署应用程序时,我遇到了这个错误,我使用了一个包
two\u factor
Otp,这是回溯 回溯:

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/contrib/admin/sites.py" in wrapper
  241.                 return self.admin_view(view, cacheable)(*args, **kwargs)

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapped_view
  142.                     response = view_func(request, *args, **kwargs)

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/contrib/admin/sites.py" in inner
  212.             if not self.has_permission(request):

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/two_factor/admin.py" in has_permission
  28.         return request.user.is_verified()

File "/tmp/8d909c171bfae2c/antenv/lib/python3.7/site-packages/django/utils/functional.py" in inner
  257.         return func(self._wrapped, *args)

Exception Type: AttributeError at /
Exception Value: 'User' object has no attribute 'is_verified'

任何帮助都将不胜感激。谢谢

您必须先调用authenticate,然后才能调用login

authenticate在对象上设置一个属性,这意味着后端已成功验证并清除该属性以进行登录

您可以使用经过身份验证的


我是怎么做到的?我是说我应该更改哪些文件?谢谢你的回答。你可以使用是经过认证的