no such table이라고 뜨는 오류좀 봐주세요

미해결질문
Juntaek Lee 프로필

1분35초경의 강의를 따라하다가 다음과 같은 에러가 발생합니다.

 

>>> post= Post.objects.create(title="this is title", content="this is content")

Traceback (most recent call last):

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute

    return self.cursor.execute(sql, params)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute

    return Database.Cursor.execute(self, query, params)

sqlite3.OperationalError: no such table: second_post

 

The above exception was the direct cause of the following exception:

 

Traceback (most recent call last):

  File "<console>", line 1, in <module>

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method

    return getattr(self.get_queryset(), name)(*args, **kwargs)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/query.py", line 422, in create

    obj.save(force_insert=True, using=self.db)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/base.py", line 741, in save

    force_update=force_update, update_fields=update_fields)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/base.py", line 779, in save_base

    force_update, using, update_fields,

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/base.py", line 870, in _save_table

    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/base.py", line 908, in _do_insert

    using=using, raw=raw)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method

    return getattr(self.get_queryset(), name)(*args, **kwargs)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/query.py", line 1186, in _insert

    return query.get_compiler(using=using).execute_sql(return_id)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1335, in execute_sql

    cursor.execute(sql, params)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 99, in execute

    return super().execute(sql, params)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute

    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers

    return executor(sql, params, many, context)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute

    return self.cursor.execute(sql, params)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__

    raise dj_exc_value.with_traceback(traceback) from exc_value

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute

    return self.cursor.execute(sql, params)

  File "/home/beanzsoft/Projects/HelloDjango/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 383, in execute

    return Database.Cursor.execute(self, query, params)

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

 

박순영 프로필
박순영 10달 전

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

 

위 오류로 보아서는 second_post라는 테이블이 sqlite3 디비 내에 존재하지 않는거 같습니다.

python manage.py makemigrations
python manage.py migrate

위의 마이그레이션을 제대로 진행하셨는지 여부와

현재 그 코드가 실행되는 웹 앱이 second라는 이름인지 확인해주세요~

지식공유자 되기
많은 사람들에게 배움의 기회를 주고,
경제적 보상을 받아보세요.
지식공유참여
기업 교육을 위한 인프런
“인프런 비즈니스” 를 통해 모든 팀원이 인프런의 강의들을
자유롭게 학습하는 환경을 제공하세요.
인프런 비즈니스