1.render() missing 1 required positional argument: ‘template_name’
多打了一个括号:

2.‘WSGIRequest’ object has no attribute ‘get’

将

改为user_login_form = UserLoginForm(request.POST)
3.数据迁移
python manage.py makemigrations
python manage.py migrate
4.python smtplib.SMTPAuthenticationError: (535, b’Error: authentication failed’)
这里使用的163邮箱发送邮件,163邮箱开启POP3/SMTP服务,设置客户端授权码,用授权码替代密码即可成功发送邮件
5.django.template.exceptions.TemplateSyntaxError: Invalid block tag on line 9: ‘static’. Did you forget to register or load this tag?

在html文件头部加上 {% load staticfiles %},成功运行
6.too many values to unpack (expected 2)
user_list = UserProfile.objects.filter(email=email)
7.Iterable over raw text documents expected, string object received.
content= [content]
本文主要介绍了在使用Django xadmin时遇到的一些常见问题及其解决方案,包括render函数参数错误、WSGIRequest对象无get属性、数据迁移、SMTP认证失败以及模板语法错误等。针对这些问题,分别给出了具体的解决办法,如修改括号、使用{% load staticfiles %}标签、调整邮箱设置和理解迭代器与字符串的区别。

1万+

被折叠的 条评论
为什么被折叠?



