Reputation: 88508
I would like to completely empty the entire database, restoring it to the way it was when I just created it, using Django's manage.py
. Possible?
Upvotes: 17
Views: 16004
Reputation: 12128
What you can do to flush the DB and not have any migrate(south) problem afterwards is:
first, reset the data from the DB:
python manage.py flush
second, fake the migrations that are already applied:
python manage.py migrate --fake
third, if you have some fixture to load:
python manage.py loaddata my_sweet_json_file
Upvotes: 22
Reputation: 32522
Yes, you can use flush.
That will reset and restore everything in your entire database, regardless of which app or project the models are in. If you have a few databases, you can specify a single one in particular by using the --database
switch
Examples:
python manage.py flush
python manage.py flush --database mydatabase
Upvotes: 2