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 from a .NET application?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I know there is no management command to drop all tables. If you don’t mind hacking Python you can write your own custom command to do that. You may find the
sqlclearoption interesting. Documentation says that./manage.py sqlclearPrints the DROP TABLE SQL statements for the given app name(s).Update:
Shamelessly appropriating @Mike DeSimone‘s comment below this answer to give a complete answer.
As of django 1.9+ it’s now