views

    cursor = connection.cursor()
    cursor.execute("select staff_name  from  alarm_platform.TBL_STAFF where staff_number=(select duty_staff_number1   from alarm_platform.TBL_DUTY a  where duty_staff_time_start  >  DATE_SUB(CURDATE(), INTERVAL 0 DAY));")
    alert_today = cursor.fetchone()
    context_bak = {'msg': alert_list}
    print(context_bak)
    return  render(request,"mysql_insert.html", {'msg_1': json.dumps(context_bak)})

html接受数据

{{ msg_1 }}