๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ป Programming/error-record

[Error] Django django.db.utils.OperationalError: no such table:

๊ฒฐ๋ก ๋ถ€ํ„ฐ ๋งํ•˜๋ฉด ๋ฉ”์„ธ์ง€ ๋งˆ์ง€๋ง‰์— ํ…Œ์ด๋ธ”์ด ์—†๋‹ค. ์ฆ‰, ์žฅ๊ณ ์˜ sqlite DB์— ํ•ด๋‹น ํ…Œ์ด๋ธ”์ด ์—†์–ด์„œ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ์ด๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ ๋งค์šฐ ๊ฐ„๋‹จํ•˜๋‹ค. ์•„์ฃผ ๊ฐ„๋‹จํ•œ ์—๋Ÿฌ์ด๋‚˜ ์ฒ˜์Œ ์žฅ๊ณ ๋ฅผ ์ ‘ํ•  ๋•Œ๋Š” ๋‹นํ™ฉ์Šค๋Ÿฌ์šธ ์ˆ˜ ์žˆ๋Š” ๋‚ด์šฉ์ด๋ผ ๊ธฐ๋กํ•˜์˜€๋‹ค.

โ“Error Message

# ์ž‘์„ฑํ•œ ์ฝ”๋“œ
python manage.py shell
(InteractiveConsole)
>>> from menus.models import Menu
>>> Menu.objects.all()

# ์—๋Ÿฌ ๋ฉ”์„ธ์ง€
Traceback (most recent call last):
...
django.db.utils.OperationalError: no such table: menus_menu

โ—๏ธsolution code

python manage.py makemigrations
python manage.py migrate

 

์—๋Ÿฌ ํ•ด๊ฒฐ!