简体   繁体   中英

Django db reset without loading fixtures

Is there an easy way to reset a django database (ie drop all data/tables, create new tables and create indexes) without loading fixture data afterwords? What I want to have is just an empty database because all data is loaded from another source (a kind of a post-processed backup).

I know that this could be achieved by piping the output of the manage sql... commands to manage dbshell , but this relies on manage dbshell and is kind of hacky...

Are there any other ways to do this?

Edit: manage reset will do it, but is there a command like reset that doesn't need the application names as parameters?

你不应该用manage.py的重置选项吗?

As far as I know, the fixtures (in initial_data file) are automatically loaded after manage.py syndcb and not after reset. So, if you do a manage.py reset yourapp it should not load the fixtures. Hmm?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM