导包
from django.contrib import messages
#输出格式
messages.success(request,'不能为空')
#前端页面的写法
{%if messages %} {% for manage in messages%} {{manage.message}} {%endfor %} {%endif%}