需要把qq邮件的POP3/SMTP服务打开 位置 设置–>账户
settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.qq.com'
EMAIL_PORT = 25
#发送邮件的邮箱
EMAIL_HOST_USER = '发送到哪个qq的邮箱'
#在邮箱中设置的客户端授权密码
EMAIL_HOST_PASSWORD = '自己的授权码'
#收件人看到的发件人
EMAIL_FROM = '海马生鲜<2569792062@qq.com>'
import djcelery
djcelery.setup_loader()
BROKER_URL = 'redis://127.0.0.1:6379/9'
CELERY_IMPORTS = ('celery_tasks.tasks')
发送邮件一般都是和注册信息绑定在一块
views
class RegisterView(View):
def get(self,request):
return render(request,'register.html')
def post(self,request):
# 获取前端发送的账号、密码、邮件
username = request.POST.get('user_name')
password = request.POST.get("pwd")
email = request.POST.get(&#