如何在django中删除数据库表?

如何在django中删除数据库表?,django,database,sql-delete,Django,Database,Sql Delete,我更改了模型并进行了迁移。然后我又更改了一次模型,当尝试python manage.py migrate时,出现错误: Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions, shop Running migrations: Applying shop.0004_auto_20180128_1331...Traceback (most recent call last): Fi

我更改了模型并进行了迁移。然后我又更改了一次模型,当尝试python manage.py migrate时,出现错误:

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, shop
Running migrations:
  Applying shop.0004_auto_20180128_1331...Traceback (most recent call last):
  File "/home/morilon/dj/intshop/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 83, in _execute
    return self.cursor.execute(sql)
  File "/home/morilon/dj/intshop/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 301, in execute
    return Database.Cursor.execute(self, query)
sqlite3.OperationalError: table "shop_brand" already exists
所以我的问题是-如何删除表“shop_brand”??? 我已经尝试了
flush
sqlflush
,但这只是从表中删除数据,而实际上并没有从表“shop_brand”中删除数据


我使用django 2.0.1和python 3.6,使用dbshell命令

python manage.py dbshell
然后,在shell中,根据使用的数据库,键入命令以显示表,以标识要删除的表

例如,对于sqlite,您将使用

。表格

仍然在shell中,可以使用SQL命令删除表

DROP TABLE shop_brand;

签出仅删除所有文件是一个选项,但我想知道如何仅删除数据库中的一个平板电脑。我尝试了但命令错误:您似乎没有安装“sqlite3”程序或在您的路径上。请参阅或安装sqlite3
sudo apt get install sqlite3
确定我将尝试。我只是觉得我只能用Django来处理它。为什么我仍然要在管理站点中删除这些表:(?