Django xadmin实战练习

1.render() missing 1 required positional argument: ‘template_name’

多打了一个括号:
Django xadmin实战练习

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

Django xadmin实战练习

Django xadmin实战练习
改为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?

Django xadmin实战练习
在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开发中常用的命令总结


下一篇:django:数据的导入和导出