我在使用django rest auth password reset时遇到了DoesNotExist错误

时间:2016-04-01 20:19:37

标签: django django-rest-auth

我已经安装并配置了django-rest-auth,除/rest-auth/password/reset/端点外,一切似乎都正常工作。

当我对它进行POST时,通过JSON传递电子邮件,返回500 - DoesNotExist错误:

DoesNotExist at /rest-auth/password/reset/ Site matching query does not exist. Request Method: POST Request URL: http://.../rest-auth/password/reset/ Django Version: 1.9.5 Exception Type: DoesNotExist Exception Value: Site matching query does not exist. Exception Location: /home/.../.local/lib/python2.7/site-packages/django/db/models/query.py in get, line 387 Python Executable: /usr/bin/python Python Version: 2.7.10

导致这种情况的原因是什么?

1 个答案:

答案 0 :(得分:2)

django-allauth(由DRA内部使用)通过搜索Site对象来查找域名。

请按照以下步骤设置网站框架: https://docs.djangoproject.com/en/1.9/ref/contrib/sites/#enabling-the-sites-framework