databasedjangosqlite

How do I drop a table from SQLite3 in DJango?


I made a model, and ran python manage.py syncdb. I think that created a table in the db. Then I realized that I had made a column incorrectly, so I changed it, and ran the same command, thinking that it would drop the old table, and add a new one.

Then I went to python manage.py shell, and tried to run .objects.all(), and it failed, saying that column doesn't exist.

I want to clear out the old table, and then run syncdb again, but I can't figure out how to do that.


Solution

  • Another simple way to do this while using Django 1.4 or below, would be

    python manage.py reset app_name
    

    which drops and re-creates the tables used by the models of this app.

    This was deprecated in Django 1.3 and is no longer available from Django 1.5