Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用django PasswordResetView发送邮件?_Django_Django Rest Framework_Django Authentication_Reset Password_Django Auth Models - Fatal编程技术网

无法使用django PasswordResetView发送邮件?

无法使用django PasswordResetView发送邮件?,django,django-rest-framework,django-authentication,reset-password,django-auth-models,Django,Django Rest Framework,Django Authentication,Reset Password,Django Auth Models,我使用django的用户模型进行身份验证,现在我为我的项目添加了密码重置, 用户并没有收到任何电子邮件,但在终端中,我收到了这条消息,并且我正在本地计算机上执行所有这些操作 在我的终端 You're receiving this email because you requested a password reset for your user account at 127.0.0.1:8000. Please go to the following page and choose a new

我使用django的用户模型进行身份验证,现在我为我的项目添加了密码重置, 用户并没有收到任何电子邮件,但在终端中,我收到了这条消息,并且我正在本地计算机上执行所有这些操作

在我的终端

You're receiving this email because you requested a password reset for your user account at 127.0.0.1:8000.

Please go to the following page and choose a new password:

http://127.0.0.1:8000/accounts/reset/Mg/aisdmr-bd229ea69f64a159ed5c744816b02ca3/

Your username, in case you’ve forgotten: xxxxx

Thanks for using our site!

The 127.0.0.1:8000 team
在myurl.py中

from django.urls import path
from django.contrib.auth import views as auth_views
from . import views
app_name = 'accounts'
urlpatterns = [
    path('login/',
         auth_views.LoginView.as_view(template_name='accounts/login.html'),
         name='login'),
    path('logout/',
         auth_views.LogoutView.as_view(),
         name='logout'),
    path('signup/',
         views.SignUp.as_view(),
         name='signup'),
    path('user/<int:pk>/',
         views.UserList.as_view(template_name='accounts/about_user.html'),
         name='about_user'),
    path('reset_password/',auth_views.PasswordResetView.as_view(), name='reset_password'),
    path('reset_password_sent/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
    path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
    path('reset_password_complete/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),

]
我也在我的电子邮件\u主机\u用户中启用了此功能

您已在设置中将
电子邮件\u后端设置为:

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
引用此后端的功能:

控制台后端只编写 将发送到标准输出的电子邮件

相反,您希望使用:


你在这里也有一个打字错误
EMAIL\u USER\u TLS=True
应该是
EMAIL\u USE\u TLS=True

谢谢@AbdulAzizBarkat,这个
EMAIL\u BACKEND='django.core.mail.backends.smtp.EmailBackend'
是否也适用于生产环境server@pavankumar它可以工作,但是对于生产服务器来说,最好使用电子邮件服务。为什么不在免费使用的时候使用呢google@pavankumar有很多事情要考虑。1) 作为一个网站,人们通常希望发送和接收来自多个地址的电子邮件(根据相关人员对电子邮件进行分类等)。2) 有了SMPT,你最终会使用一些常见的电子邮件地址,现在每个人都需要它的凭据,等等。3)谷歌还限制了你可以通过SMTP发送的电子邮件数量。
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'