HOME/Articles/

mysql example views (snippet)

Article Outline

Python mysql example 'views'

Functions in program:

  • def anken_template(request):

python views

Python mysql example: views

from django.http.response import HttpResponse
from django.shortcuts import render

from mysql-connector-python import mysql

def anken_template(request):

    cur = conn.cursor(dictionary=True)

    cur.execute('SELECT id, develop FROM anken')

    cur.fetchall()

    return render(request, 'anken.html', cur)