Home » Cloud Technologies » Solved: django.db.utils.OperationalError: no such table

Solved: django.db.utils.OperationalError: no such table

When we tried to run django server after copied from one directory to another and deleting the cache files __pycache__ and database db.sqlite3 so that we can run the server at new location, suddenly we got an error as below,

django.db.utils.OperationalError: no such table:

This seems possibly that we deleted the database and cache manually and didn’t follow the initialisation steps properly since we just copied the code from one directory to another. So instead of doing all steps again, we can resolve this error by following steps,

Solution

$ python manage.py makemigrations
$ python manage.py migrate --run-syncdb
$ python manage.py migrate

You can refer more about Django & REST at

Installing Django and Django-REST Framework on ubuntu

Leave a Comment