1.执行

python manager.py shell

进入交互模式

2.连接数据库

from django.db import connection, transaction
cur = connection.cursor()
3.执行sql语句操作数据库

cur.execute("drop table south_migrationhistory")  # delete table south_migrationhistory
transaction.commit_unless_managed()   # commit changes to database



Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐