单击djoser发送的链接后如何激活? 我的设置 '''
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'djoser',
'rest_framework',
'rest_framework_simplejwt',
'data',
]
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES':(
'rest_framework_simplejwt.authentication.JWTAuthentication',
'rest_framework.authentication.SessionAuthentication',
),
}
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'technomancer7629@gmail.com'
EMAIL_HOST_PASSWORD='naz@technomancer7629'
EMAIL_PORT = 587
PROTOCOL = "http"
DOMAIN = "127.0.0.1:8000"
DJOSER = {
'PASSWORD_RESET_CONFIRM_URL': '/password/reset/confirm/{uid}/{token}',
'USERNAME_RESET_CONFIRM_URL': '/username/reset/confirm/{uid}/{token}',
'ACTIVATION_URL': 'auth/user/activate/{uid}/{token}',
'SEND_ACTIVATION_EMAIL': True,
'SEND_CONFRIMATION_EMAIL':True,
'SERIALIZERS': {},
'EMAIL':{
'activation': 'djoser.email.ActivationEmail',
},
}
''' urls.py '''
urlpatterns = [
path('admin/', admin.site.urls),
path('auth/',include('djoser.urls')),
path('auth/',include('djoser.urls.jwt')),
path("api/data/",include("data.urls")),
]
''' 我的电子邮件链接 http://127.0.0.1:8000/auth/users/activate/Mjc/5bx-5f9542251fd9db7e980b 错误:
使用 startgo1.urls 中定义的 URLconf,Django 按以下顺序尝试了这些 URL 模式:
admin/
auth/ ^users/$ [name='user-list']
auth/ ^users\.(?P<format>[a-z0-9]+)/?$ [name='user-list']
auth/ ^users/activation/$ [name='user-activation']
auth/ ^users/activation\.(?P<format>[a-z0-9]+)/?$ [name='user-activation']
auth/ ^users/me/$ [name='user-me']
auth/ ^users/me\.(?P<format>[a-z0-9]+)/?$ [name='user-me']
auth/ ^users/resend_activation/$ [name='user-resend-activation']
auth/ ^users/resend_activation\.(?P<format>[a-z0-9]+)/?$ [name='user-resend-activation']
auth/ ^users/reset_password/$ [name='user-reset-password']
auth/ ^users/reset_password\.(?P<format>[a-z0-9]+)/?$ [name='user-reset-password']
auth/ ^users/reset_password_confirm/$ [name='user-reset-password-confirm']
auth/ ^users/reset_password_confirm\.(?P<format>[a-z0-9]+)/?$ [name='user-reset-password-confirm']
auth/ ^users/reset_username/$ [name='user-reset-username']
auth/ ^users/reset_username\.(?P<format>[a-z0-9]+)/?$ [name='user-reset-username']
auth/ ^users/reset_username_confirm/$ [name='user-reset-username-confirm']
auth/ ^users/reset_username_confirm\.(?P<format>[a-z0-9]+)/?$ [name='user-reset-username-confirm']
auth/ ^users/set_password/$ [name='user-set-password']
auth/ ^users/set_password\.(?P<format>[a-z0-9]+)/?$ [name='user-set-password']
auth/ ^users/set_username/$ [name='user-set-username']
auth/ ^users/set_username\.(?P<format>[a-z0-9]+)/?$ [name='user-set-username']
auth/ ^users/(?P<pk>[^/.]+)/$ [name='user-detail']
auth/ ^users/(?P<pk>[^/.]+)\.(?P<format>[a-z0-9]+)/?$ [name='user-detail']
auth/ ^$ [name='api-root']
auth/ ^\.(?P<format>[a-z0-9]+)/?$ [name='api-root']
auth/ ^jwt/create/? [name='jwt-create']
auth/ ^jwt/refresh/? [name='jwt-refresh']
auth/ ^jwt/verify/? [name='jwt-verify']
api/data/
当前路径 auth/users/activate/Mjc/5bx-5f9542251fd9db7e980b 与其中任何一个都不匹配。