inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

실리콘밸리 엔지니어가 가르치는 파이썬 장고 웹프로그래밍

Model Form(모델 폼)에 대해 알아보기

form.save() 부분이 안돼요

339

Zmann

작성한 질문수 1

1

Internal Server Error: /polls/survey/

Traceback (most recent call last):

File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute

return self.cursor.execute(sql, params)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute

return super().execute(query, params)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sqlite3.OperationalError: no such table: polls_survey

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

Traceback (most recent call last):

File "/opt/homebrew/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner

response = get_response(request)

^^^^^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in getresponse

response = wrapped_callback(request, callback_args, *callback_kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Users/minjiwon/Desktop/py/mysite/polls/views.py", line 98, in survey

form.save()

File "/opt/homebrew/lib/python3.11/site-packages/django/forms/models.py", line 542, in save

self.instance.save()

File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/base.py", line 814, in save

self.save_base(

File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/base.py", line 877, in save_base

updated = self._save_table(

^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/base.py", line 1020, in savetable

results = self._do_insert(

^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/base.py", line 1061, in doinsert

return manager._insert(

^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method

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

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/query.py", line 1805, in _insert

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

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1822, in execute_sql

cursor.execute(sql, params)

File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 102, in execute

return super().execute(sql, params)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute

return self._execute_with_wrappers(

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in executewith_wrappers

return executor(sql, params, many, context)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute

with self.db.wrap_database_errors:

File "/opt/homebrew/lib/python3.11/site-packages/django/db/utils.py", line 91, in exit

raise dj_exc_value.with_traceback(traceback) from exc_value

File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute

return self.cursor.execute(sql, params)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/opt/homebrew/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute

return super().execute(query, params)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

[05/Jul/2023 05:30:34] "POST /polls/survey/ HTTP/1.1" 500 141650

 

이렇게 뜨면서 안되고 어드민에서 survey 들어가는 것도 안되는데 makemigrations 다시 해봐도 똑같아요

python django bootstrap rest-api drf

답변 1

0

미쿡엔지니어

안녕하세요 Zmann님,

일단 질문 잘 하셨구요. 제가 보기에는 마지막에 있는 에러 문구가 안되는 이유인 것 같습니다.

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

에러 그대로 현재 polls_survey라는 테이블이 데이타베이스에 없는 점이 문제입니다.

혹시 migration은 하셨나요?

python manage.py migrate

위에 커맨드를 해보시면 migrations의 내용들이 데이타베이스에 적용되는 것을 보실 수 있을 듯 합니다.

자세한 내용은 https://docs.djangoproject.com/en/4.2/topics/migrations/ 있습니다.

Dockerfile 질문

0

76

2

Logging 질문

0

126

1

0.0.0.0:8000 접속이 안됩니다

0

298

2

블로그 게시

0

171

2

{{form.as_p}} 사용방법 질문드립니다.

0

230

2

reverse vs reverse_lazy 사용 이유와 차이점을 이해하지 못 했습니다.

0

214

1

urls.py에 라우팅 하는 부분에서요.

0

163

2

handler, static 질문이 있습니다.

0

188

2

build: context 부분이 이해가 되지 않습니다.

1

215

3

직렬화 질문

0

152

1

Celery 수업중 세팅 질문드립니다.

1

181

1

6-1 질문

1

216

1

channels alternative?

1

208

1

크롬에서 서드 파티 쿠키 제한이라는 에러가 뜨는데 혹시 추가로 어떤걸 업데이트 해야지 정상작동 되는지 알 수 있을까요?

0

741

2

dock 환경설정에 대해 잘 이해가 가지 않습니다.

1

283

1

Django Authentication 중에 로그아웃 기능이 안됩니다 ㅠㅠ

1

345

1

학습방식

1

321

2

docker, flower 질문

0

303

1

docker 컨테이너 환경설정 문제

0

1642

1

celery-worker, beat, flower, docker-compose 질문

1

635

1

4-1 공식문서

1

253

1

장고 프로젝트 질문

2

293

1

복습

1

259

1

온라인 ide

1

327

2