Cleaning your database and starting over in Django

I haven’t posted any django information in a while because I haven’t had any time to mess with it. Today, I dove back in.

I wanted to get a fresh start with the project I’m working on so I thought I’d clear out the database. Why for the life of me I couldn’t find the proper incantation to make this happen I’ll never know.

After searching for about 10 minutes I found it. I’m posting it here so I can reference it the next time I have a brain lapse.

Are you ready? Here it is…
manage.py flush

This will reset the database to the state immediately after it was created.

5 Responses to “Cleaning your database and starting over in Django”

  1. Jason
    January 20, 2009 at 4:50 pm #

    awesome! thanks for this

  2. Alvaro Brange
    February 21, 2009 at 6:07 pm #

    Thank you. It works. For others commands you can see documentation: http://docs.djangoproject.com/en/dev/ref/django-admin/

    Best regards,
    Álvaro

  3. joecotellese
    March 2, 2009 at 9:25 pm #

    Yes, you could see the documentation. I put this here because I kept for getting how to do this! :)

  4. Cyril Pauya
    December 23, 2009 at 2:18 am #

    Thanks much! :)

  5. Rich Jones
    August 29, 2011 at 5:22 pm #

    Another useful one is

    ./manage reset yourappname

    if you don’t want to ruin the _whole_ thing.

Leave a Reply