Django Syncdb Error - Table Doesn't Exist

Do you like this?

There seem to be many possible reason to this problem. However, in my case, it happened because I copied code from one project to another including the databases.


Symptom: When I ran " syncdb", the following commands showed up:

The following content types are stale and need to be deleted:

    myproject | tableA
    myproject | tableB
    myproject | tableC

Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.

    Type 'yes' to continue, or 'no' to cancel: yes (I typed in)


    (1146, "Table 'myproject.django_comments' doesn't exist")

To fix this issue, what I did was to open PHPMyAdmin (or any SQL clients of your choice). I then opened the table django_content_type and removed the following tables in the database:
    myproject | tableA
    myproject | tableB
    myproject | tableC

After that, I can run the command syncdb again without any errors.

comments powered by Disqus