[Fixed]-Emptying the database through Django's `manage.py`


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


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


python manage.py flush
python manage.py flush --database mydatabase

Leave a comment