How to drop all tables from the database with manage.py CLI in Django?

前端 未结 18 1743
余生分开走
余生分开走 2020-11-29 16:54

How can I drop all tables from a database using manage.py and command line? Is there any way to do that executing manage.py with appropriate parameters so I can execute it f

18条回答
  •  没有蜡笔的小新
    2020-11-29 17:50

    If you're using the South package to handle database migrations (highly recommended), then you could just use the ./manage.py migrate appname zero command.

    Otherwise, I'd recommend the ./manage.py dbshell command, piping in SQL commands on standard input.

提交回复
热议问题