大家好,我正在为后端开发一个使用django rest框架的网站,我使用dj-rest-auth进行身份验证。我想用电子邮件实现注册,基于dj-rest-auth的文档,这些是用于注册的urls:
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')),
]在设置中,我做了这些事情:
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。
但在发送用户信息进行注册后,我收到了这个错误:
Reverse for 'account_confirm_email' not found. 'account_confirm_email' is not a valid view function or pattern name.有人能告诉我我哪里错了吗?
发布于 2020-12-08 02:24:50
这在常见问题解答部分read the first question中进行了解释。
https://stackoverflow.com/questions/65183817
复制相似问题