首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用dj-rest-auth进行电子邮件验证的注册

使用dj-rest-auth进行电子邮件验证的注册
EN

Stack Overflow用户
提问于 2020-12-07 22:40:45
回答 1查看 1.2K关注 0票数 0

大家好,我正在为后端开发一个使用django rest框架的网站,我使用dj-rest-auth进行身份验证。我想用电子邮件实现注册,基于dj-rest-auth的文档,这些是用于注册的urls:

代码语言:javascript
复制
urlpatterns = [
path('api-auth/', include('rest_framework.urls')),

path('dj-rest-auth/', include('dj_rest_auth.urls')),

path('dj-rest-auth/registration/', include('dj_rest_auth.registration.urls')),  
path('dj-rest-auth/registration/verify-email/',
  include('dj_rest_auth.registration.urls')),  
]

在设置中,我做了这些事情:

代码语言:javascript
复制
INSTALLED_APPS = [
    'accounts.apps.AccountsConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'corsheaders',

    'rest_framework',
    'rest_framework.authtoken',
    'dj_rest_auth',

    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'dj_rest_auth.registration',
]

SITE_ID = 1
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_CONFIRM_EMAIL_ON_GET = True

LOGIN_URL = 'http://localhost:8000/accounts_api/api/v1/dj-rest-auth/login'

我正在为smtp使用gmail smtp

但在发送用户信息进行注册后,我收到了这个错误:

代码语言:javascript
复制
Reverse for 'account_confirm_email' not found. 'account_confirm_email' is not a valid view function or pattern name.

有人能告诉我我哪里错了吗?

EN

回答 1

Stack Overflow用户

发布于 2020-12-08 02:24:50

这在常见问题解答部分read the first question中进行了解释。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65183817

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档