Recover dropped table in Django : Table doesn't exist

a quick fix for Django : Table doesn't exist error.


It's accidental to delete a table when performing some actions or on purpose to get rid of cluster. Django has a good in-build engine that can manage the changes in models and your database synced but if you happen to drop a migrated table you will end up with Django : Table doesn't exist. Here's how you can fix it.

  • Drop tables ( you most probably completed :p )
  • Comment-out the model in and other locations where the model is induced, else System-checks will fail
  • if django version >= 1.7 for older see below
    python makemigrations
    python migrate --fake
  • comment-in your model in
  • Run makemigrations and migrate again without using --fake
  • You are back on track.

    Note: This does not bring back the data lost when you dropped the table, it recreates the database table and allows further use of application

    If you have django version less than 1.7 use schemamigration to get the magic:

    python schemamigration  --auto
    python migrate someapp --fake


Wow ! you have someting to tell us. That's great! Please keep in mind that comments are moderated, we employ rel="nofollow" for links, avoid using a spammy word or a domain in name field, it might end up as a Spam. Thanks for reading.

Last 5 Articles

All Articles >

  1. Mitigating Risks In Custom Software Development

  2. Container Security to Secure Microservices

  3. Strategic Messaging

  4. URL Shortener in Django

  5. MySQL as Database Option


News Letter

Subscribe to our email newsletter for useful tips and valuable resources, sent out every new article release.