1、

2、在view.py文件中使用truncate

def software(request):
    db = MySQLdb.connect("10.116.xx.xx", "root", "xxxxxxpassword", "xxxxxdatabase", charset="utf8")
    cursor = db.cursor()
    cursor.execute("select version()")
    data=cursor.fetchone()
    cursor.execute("truncate table  app01_softlist")
    print("database version : %s"%data)