inflearn logo
강의

講義

知識共有

PythonでDjangoを攻略する:入門

データ生成

1분 26초에 post=Post.objects.create(title="this is title", content="this is content")부분이 실행이 안됩니다.

267

suhyeon

投稿した質問数 2

0

이것을 입력하면 이런식으로 오류가 나는데 무엇이 문제인지 모르겠습니다...
>>> post = Post.objects.create(title="this is title", content="this is content")
Traceback (most recent call last): File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute return Database.Cursor.execute(self, query, params) sqlite3.OperationalError: table second_post has no column named content The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<console>", line 1, in <module> File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\query.py", line 453, in create obj.save(force_insert=True, using=self.db) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\base.py", line 726, in save self.save_base(using=using, force_insert=force_insert, File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\base.py", line 763, in save_base updated = self._save_table( File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\base.py", line 868, in _save_table results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\base.py", line 906, in _do_insert return manager._insert( File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\query.py", line 1270, in _insert return query.get_compiler(using=using).execute_sql(returning_fields) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1416, in execute_sql cursor.execute(sql, params) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\backends\utils.py", line 98, in execute return super().execute(sql, params) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\backends\utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "C:\Users\82108\OneDrive\문서\Django-study\projects\first-django\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute return Database.Cursor.execute(self, query, params) django.db.utils.OperationalError: table second_post has no column named content있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 만들어가요.
- 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.

django python

回答 1

0

shinycoo1752

제가 한동안 질문 게시판을 보질 못해서 답변이 늦었습니다 ㅠ

 

해당 로그의 마지막을 보시면 

django.db.utils.OperationalError: table second_post has no column named content

이렇게 표시됩니다.

post 모델에 content라는 컬럼이 없다는 건데요. Post 모델 클래스에 content가 제대로 선언되었는지와 migrate까지 진행되었는지 체크해주세요.

빨간 줄이 뜨네요

0

137

1

import 문장에 빨간줄이 뜹니다.

0

156

1

putty 관련 질문

0

192

1

uWSGI 세팅하기_ 최종 502 bad gateway error

0

809

1

putty 접속관련

0

305

1

[리뷰 삭제하기] 삭제시 path 에러문구나옴.

0

386

1

데이터 새성시 forms.py, models.py 관련문의

0

308

1

'폼으로 데이터 전송하기' 강의 소리가 갑자기 작아짐

0

318

1

[스태틱]index.html 의 이미지를 변경하려면 ?

0

508

1

WARNINGS: ?: (staticfiles.W004) The directory 'C:\projects\first-django\static' in the STATICFILES_DIRS setting does not exist.

0

427

1

사진 넣고 엑박...ㅜㅜ

0

335

0

간단한 웹 페이지 띄우기 강의 10분 후반쯤

0

419

0

리뷰 등록 구현하기 4:26 url 오류

0

347

1

create.html

0

361

1

502 badgateway 오류가 떠요

0

284

0

putty에서 막혔네요 ㅠㅠ

0

355

2

django) 한 폼에 여러 모델 데이터 입력하는 경우

0

328

0

파이참 안에서 가상환경 접속이 안 됩니다.

0

691

1

settings.py

0

305

1

만약 웹앱을 업데이트할경우는 어떻게 해야하나요?

0

374

1

CSS 가운데 정렬 적용 안됨

0

4833

3

NameError: name 'os' is not defined

2

1107

1

virtualenv가 설치가 안됩니다..

0

439

1

자꾸 에러가뜹니다

0

746

1