Django - no such table exception

이다연·2021년 4월 15일
0

Django

목록 보기
30/33

I ran into migratioin problem when deploying at Heroku.

Order of migrations matters. I decided to delete all and start fresh.

Solution was clearing out existing sqlite db and migration histories.


60

I solved the same problem with these steps :

    Delete your database (db.sqlite3 in my case) in your project directory
    Remove everything from __pycache__ folder under your project subdirectory
    For the application you are trying to fix, go to the folder and clear migrations and __pycache__ directories

When you are sure you have cleared all the above files, run:

python manage.py makemigrations
python manage.py migrate

For it to work,
comment out current views, urls and such as if when you first set up a project.

Set up simple urls, and views and settings.py.

You need to leave migrations folder itself and init.py inside. Otherwise, makemigrations won't detect any models and changes.

https://stackoverflow.com/questions/34548768/django-no-such-table-exception

migrations
https://www.algotech.solutions/blog/python/django-migrations-and-how-to-manage-conflicts/

profile
Dayeon Lee | Django & Python Web Developer

0개의 댓글