장고로 사이트 제작중 IntegrityError

점프투 장고 3-4까지 진행완료하고 사이트 접속해서 답변등록을 해봤는데

IntegrityError at /pybo/answer/create/305/
NOT NULL constraint failed: pybo_answer.create_data
Request Method: POST
Request URL: http://127.0.0.1:8000/pybo/answer/create/305/
Django Version: 3.1.3
Exception Type: IntegrityError
Exception Value:
NOT NULL constraint failed: pybo_answer.create_data
Exception Location: C:\venvs\mysite\lib\site-packages\django\db\backends\sqlite3\base.py, line 413, in execute
Python Executable: C:\venvs\mysite\Scripts\python.exe
Python Version: 3.8.8
Python Path:
['c:\projects\mysite',
'C:\ProgramData\Anaconda3\python38.zip',
'C:\ProgramData\Anaconda3\DLLs',
'C:\ProgramData\Anaconda3\lib',
'C:\ProgramData\Anaconda3',
'C:\venvs\mysite',
'C:\venvs\mysite\lib\site-packages']
Server time: Thu, 07 Oct 2021 17:24:07 +0900
Traceback Switch to copy-and-paste view
C:\venvs\mysite\lib\site-packages\django\db\backends\utils.py, line 84, in _execute
return self.cursor.execute(sql, params) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\backends\sqlite3\base.py, line 413, in execute
return Database.Cursor.execute(self, query, params) …
▶ Local vars
The above exception (NOT NULL constraint failed: pybo_answer.create_data) was the direct cause of the following exception:
C:\venvs\mysite\lib\site-packages\django\core\handlers\exception.py, line 47, in inner
response = get_response(request) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\core\handlers\base.py, line 179, in _get_response
response = wrapped_callback(request, callback_args, callback_kwargs) …
▶ Local vars
c:\projects\mysite\pybo\views.py, line 65, in answer_create
answer.save() …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\models\base.py, line 753, in save
self.save_base(using=using, force_insert=force_insert, …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\models\base.py, line 790, in save_base
updated = self._save_table( …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\models\base.py, line 895, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\models\base.py, line 933, in _do_insert
return manager._insert( …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\models\manager.py, line 85, in manager_method
return getattr(self.get_queryset(), name)(
args, **kwargs) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\models\query.py, line 1254, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\models\sql\compiler.py, line 1397, in execute_sql
cursor.execute(sql, params) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\backends\utils.py, line 98, in execute
return super().execute(sql, params) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\backends\utils.py, line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\backends\utils.py, line 75, in _execute_with_wrappers
return executor(sql, params, many, context) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\backends\utils.py, line 84, in _execute
return self.cursor.execute(sql, params) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\utils.py, line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\backends\utils.py, line 84, in _execute
return self.cursor.execute(sql, params) …
▶ Local vars
C:\venvs\mysite\lib\site-packages\django\db\backends\sqlite3\base.py, line 413, in execute
return Database.Cursor.execute(self, query, params) …
▶ Local vars
Request information
USER
admin

GET
No GET data

POST
Variable Value
csrfmiddlewaretoken
'W3wfGuH0dgbjEwrVW3EKXB3IxRj2jOHrbHHWaxMiV4FXKN5VQMOWsnRiNo0Kf71U'
content
'아무\r\n'
FILES
No FILES data

COOKIES
Variable Value
csrftoken
'ARn6JqEUCX3U4bFWsPC6xCWjpk0BELUFPvyNdtJckLxyasjWmyMi2oKTFRHjA4e8'
sessionid
'opd1bw5k157hpducm0ktc9i80otcxg90'
META
Variable Value
ALLUSERSPROFILE
'C:\ProgramData'
APPDATA
'C:\Users\user\AppData\Roaming'
COMMONPROGRAMFILES
'C:\Program Files\Common Files'
COMMONPROGRAMFILES(X86)
'C:\Program Files (x86)\Common Files'
COMMONPROGRAMW6432
'C:\Program Files\Common Files'
COMPUTERNAME
'DESKTOP-DSA538I'
COMSPEC
'C:\WINDOWS\system32\cmd.exe'
CONTENT_LENGTH
'117'
CONTENT_TYPE
'application/x-www-form-urlencoded'
CSRF_COOKIE
'ARn6JqEUCX3U4bFWsPC6xCWjpk0BELUFPvyNdtJckLxyasjWmyMi2oKTFRHjA4e8'
DJANGO_SETTINGS_MODULE
'config.settings'
DRIVERDATA
'C:\Windows\System32\Drivers\DriverData'
FPS_BROWSER_APP_PROFILE_STRING
'Internet Explorer'
FPS_BROWSER_USER_PROFILE_STRING
'Default'
GATEWAY_INTERFACE
'CGI/1.1'
HOMEDRIVE
'C:'
HOMEPATH
'\Users\user'
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9'
HTTP_ACCEPT_ENCODING
'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE
'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
HTTP_CACHE_CONTROL
'max-age=0'
HTTP_CONNECTION
'keep-alive'
HTTP_COOKIE
('csrftoken=ARn6JqEUCX3U4bFWsPC6xCWjpk0BELUFPvyNdtJckLxyasjWmyMi2oKTFRHjA4e8; '
'sessionid=opd1bw5k157hpducm0ktc9i80otcxg90')
HTTP_HOST
'127.0.0.1:8000'
HTTP_ORIGIN
'http://127.0.0.1:8000'
HTTP_REFERER
'http://127.0.0.1:8000/pybo/305/'
HTTP_SEC_CH_UA
'"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"'
HTTP_SEC_CH_UA_MOBILE
'?0'
HTTP_SEC_CH_UA_PLATFORM
'"Windows"'
HTTP_SEC_FETCH_DEST
'document'
HTTP_SEC_FETCH_MODE
'navigate'
HTTP_SEC_FETCH_SITE
'same-origin'
HTTP_SEC_FETCH_USER
'?1'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
HTTP_USER_AGENT
('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like '
'Gecko) Chrome/94.0.4606.71 Safari/537.36')
LOCALAPPDATA
'C:\Users\user\AppData\Local'
LOGONSERVER
'\\DESKTOP-DSA538I'
NUMBER_OF_PROCESSORS
'8'
ONEDRIVE
'C:\Users\user\OneDrive'
OS
'Windows_NT'
PATH
('C:\venvs\mysite\Scripts;C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\Program '
'Files (x86)\VMware\VMware '
'Workstation\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program '
'Files (x86)\Bitvise SSH '
'Client;C:\Users\user\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python310\;C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python39\;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\venvs;;C:\Program '
'Files (x86)\ESTsoft\ALSee\x64')
PATHEXT
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
PATH_INFO
'/pybo/answer/create/305/'
PROCESSOR_ARCHITECTURE
'AMD64'
PROCESSOR_IDENTIFIER
'Intel64 Family 6 Model 166 Stepping 0, GenuineIntel'
PROCESSOR_LEVEL
'6'
PROCESSOR_REVISION
'a600'
PROGRAMDATA
'C:\ProgramData'
PROGRAMFILES
'C:\Program Files'
PROGRAMFILES(X86)
'C:\Program Files (x86)'
PROGRAMW6432
'C:\Program Files'
PROMPT
'(mysite) $P$G'
PSMODULEPATH
'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\'
PT8HOME
'C:\Program Files\Cisco Packet Tracer 8.0.1'
PUBLIC
'C:\Users\Public'
QT_DEVICE_PIXEL_RATIO
'auto'
QUERY_STRING
''
REMOTE_ADDR
'127.0.0.1'
REMOTE_HOST
''
REQUEST_METHOD
'POST'
RUN_MAIN
'true'
SCRIPT_NAME
''
SERVER_NAME
'DESKTOP-DSA538I'
SERVER_PORT
'8000'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SOFTWARE
'WSGIServer/0.2'
SESSIONNAME
'Console'
SYSTEMDRIVE
'C:'
SYSTEMROOT
'C:\WINDOWS'
TEMP
'C:\Users\user\AppData\Local\Temp'
TMP
'C:\Users\user\AppData\Local\Temp'
USERDOMAIN
'DESKTOP-DSA538I'
USERDOMAIN_ROAMINGPROFILE
'DESKTOP-DSA538I'
USERNAME
'user'
USERPROFILE
'C:\Users\user'
VIRTUAL_ENV
'C:\venvs\mysite'
WINDIR
'C:\WINDOWS'
_OLD_VIRTUAL_PATH
('C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\Program '
'Files (x86)\VMware\VMware '
'Workstation\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program '
'Files (x86)\Bitvise SSH '
'Client;C:\Users\user\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python310\;C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python39\;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\venvs;;C:\Program '
'Files (x86)\ESTsoft\ALSee\x64')
_OLD_VIRTUAL_PROMPT
'$P$G'
wsgi.errors
<_io.TextIOWrapper name='' mode='w' encoding='utf-8'>
wsgi.file_wrapper

wsgi.input

wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)
Settings
Using settings module config.settings
Setting Value
ABSOLUTE_URL_OVERRIDES
{}
ADMINS
[]
ALLOWED_HOSTS
[]
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS
'****'
AUTH_USER_MODEL
'auth.User'
BASE_DIR
WindowsPath('C:/projects/mysite')
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS
'default'
CACHE_MIDDLEWARE_KEY_PREFIX
'
***'
CACHE_MIDDLEWARE_SECONDS
600
CSRF_COOKIE_AGE
31449600
CSRF_COOKIE_DOMAIN
None
CSRF_COOKIE_HTTPONLY
False
CSRF_COOKIE_NAME
'csrftoken'
CSRF_COOKIE_PATH
'/'
CSRF_COOKIE_SAMESITE
'Lax'
CSRF_COOKIE_SECURE
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS
[]
CSRF_USE_SESSIONS
False
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.sqlite3',
'HOST': '',
'NAME': WindowsPath('C:/projects/mysite/db.sqlite3'),
'OPTIONS': {},
'PASSWORD': '
**',
'PORT': '',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIGRATE': True,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': ''}}
DATABASE_ROUTERS
[]
DATA_UPLOAD_MAX_MEMORY_SIZE
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS
1000
DATETIME_FORMAT
'N j, Y, P'
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M']
DATE_FORMAT
'N j, Y'
DATE_INPUT_FORMATS
['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
DEBUG
True
DEBUG_PROPAGATE_EXCEPTIONS
False
DECIMAL_SEPARATOR
'.'
DEFAULT_CHARSET
'utf-8'
DEFAULT_EXCEPTION_REPORTER
'django.views.debug.ExceptionReporter'
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL
'webmaster@localhost'
DEFAULT_HASHING_ALGORITHM
'sha256'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
[]
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'
**'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SSL_CERTFILE
None
EMAIL_SSL_KEYFILE
'
**'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_TIMEOUT
None
EMAIL_USE_LOCALTIME
False
EMAIL_USE_SSL
False
EMAIL_USE_TLS
False
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FILE_UPLOAD_PERMISSIONS
420
FILE_UPLOAD_TEMP_DIR
None
FIRST_DAY_OF_WEEK
0
FIXTURE_DIRS
[]
FORCE_SCRIPT_NAME
None
FORMAT_MODULE_PATH
None
FORM_RENDERER
'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS
[]
INSTALLED_APPS
['pybo.apps.PyboConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
INTERNAL_IPS
[]
LANGUAGES
[('af', 'Afrikaans'),
('ar', 'Arabic'),
('ar-dz', 'Algerian Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('dsb', 'Lower Sorbian'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hsb', 'Upper Sorbian'),
('hu', 'Hungarian'),
('hy', 'Armenian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('ig', 'Igbo'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kab', 'Kabyle'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('ky', 'Kyrgyz'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmål'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('tg', 'Tajik'),
('th', 'Thai'),
('tk', 'Turkmen'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('uz', 'Uzbek'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI
['he', 'ar', 'ar-dz', 'fa', 'ur']
LANGUAGE_CODE
'ko-kr'
LANGUAGE_COOKIE_AGE
None
LANGUAGE_COOKIE_DOMAIN
None
LANGUAGE_COOKIE_HTTPONLY
False
LANGUAGE_COOKIE_NAME
'django_language'
LANGUAGE_COOKIE_PATH
'/'
LANGUAGE_COOKIE_SAMESITE
None
LANGUAGE_COOKIE_SECURE
False
LOCALE_PATHS
[]
LOGGING
{}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MANAGERS
[]
MEDIA_ROOT
''
MEDIA_URL
'/'
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NUMBER_GROUPING
0
PASSWORD_HASHERS
'
**'
PASSWORD_RESET_TIMEOUT
'
**'
PASSWORD_RESET_TIMEOUT_DAYS
'
**'
PREPEND_WWW
False
ROOT_URLCONF
'config.urls'
SECRET_KEY
'
*****'
SECURE_BROWSER_XSS_FILTER
False
SECURE_CONTENT_TYPE_NOSNIFF
True
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
SECURE_HSTS_PRELOAD
False
SECURE_HSTS_SECONDS
0
SECURE_PROXY_SSL_HEADER
None
SECURE_REDIRECT_EXEMPT
[]
SECURE_REFERRER_POLICY
'same-origin'
SECURE_SSL_HOST
None
SECURE_SSL_REDIRECT
False
SERVER_EMAIL
'root@localhost'
SESSION_CACHE_ALIAS
'default'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_HTTPONLY
True
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SAMESITE
'Lax'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_FILE_PATH
None
SESSION_SAVE_EVERY_REQUEST
False
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE
'config.settings'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
STATICFILES_DIRS
[WindowsPath('C:/projects/mysite/static')]
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT
None
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [WindowsPath('C:/projects/mysite/templates')],
'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS
[]
TEST_RUNNER
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR
','
TIME_FORMAT
'P'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE
'Asia/Seoul'
USE_I18N
True
USE_L10N
True
USE_THOUSAND_SEPARATOR
False
USE_TZ
True
USE_X_FORWARDED_HOST
False
USE_X_FORWARDED_PORT
False
WSGI_APPLICATION
'config.wsgi.application'
X_FRAME_OPTIONS
'DENY'
YEAR_MONTH_FORMAT
'F Y'
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.

이렇게 뜹니다.. 뭐때문에 오류가 난지 모르겠어요 ㅠㅠ
config/urls.py

"""config URL Configuration

The urlpatterns list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path

from django.contrib import admin
from django.urls import path, include
from pybo import views
urlpatterns = [
path('admin/', admin.site.urls),
path('pybo/', include('pybo.urls')),
]

pybo/urls.py

from django.urls import path
from . import views

app_name = 'pybo'

urlpatterns = [
path('', views.index, name='index'),
path('/', views.detail, name='detail'),
path('answer/create//', views.answer_create, name='answer_create'),
path('question/create/', views.question_create, name='question_create'),
]

pybo/views.py

from django.shortcuts import render

Create your views here.

from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404, redirect
from .models import Question
from django.utils import timezone
from .forms import QuestionForm, AnswerForm
from django.core.paginator import Paginator

def question_create(request):
"""
pybo 질문등록
"""
if request.method == 'POST':
form = QuestionForm(request.POST)
if form.is_valid():
question = form.save(commit=False)
question.create_date = timezone.now()
question.save()
return redirect('pybo:index')
else:
form = QuestionForm()
context = {'form': form}
return render(request, 'pybo/question_form.html', context)

def index(request):
"""
pybo 목록 출력
"""
# 입력 파라미터
page = request.GET.get('page', '1') # 페이지

# 조회
question_list = Question.objects.order_by('-create_date')

# 페이징처리
paginator = Paginator(question_list, 10)  # 페이지당 10개씩 보여주기
page_obj = paginator.get_page(page)

context = {'question_list': page_obj}
return render(request, 'pybo/question_list.html', context)
return HttpResponse("안녕하세요 pybo에 오신것을 환영합니다.")

def detail(request, question_id):
"""
pybo 내용 출력
"""
question = get_object_or_404(Question, pk=question_id)
context = {'question': question}
return render(request, 'pybo/question_detail.html', context)

def answer_create(request, question_id):
"""
답변등록
"""
question = get_object_or_404(Question, pk=question_id)
if request.method == 'POST':
form = AnswerForm(request.POST)
if form.is_valid():
answer = form.save(commit=False)
answer.create_date = timezone.now()
answer.question = question
answer.save()
return redirect('pybo:detail', question_id=question.id)
else:
form = AnswerForm()
context = {'question': question, 'form': form}
return render(request, 'pybo/question_detail.html', context)

    입니다. 답변 부탁드리겠습니다 ㅠㅠ

한준규 65

2021년 10월 7일 5:43 오후

목록으로
2개의 답변이 있습니다. 1 / 1 Page

답변 등록시 필수 속성 값이 저장 안되어서 발생하는 오류같습니다.

작성하신 answer_create 함수와 question_detail 템플릿을 보여주세요.
그리고 글을 올리실때는 마크다운 문법을 지켜 주세요.

박응용

2021년 10월 8일 1:40 오전

죄송합니다 양식에 맞춰 올려야한다는 글을 미처 보지못했습니다. 아래 answer_create 함수와 question_datail 템플릿 올리겠습니다. def answer_create(request, question_id): """ 답변등록 """ question = get_object_or_404(Question, pk=question_id) if request.method == 'POST': form = AnswerForm(request.POST) if form.is_valid(): answer = form.save(commit=False) answer.create_date = timezone.now() answer.question = question answer.save() return redirect('pybo:detail', question_id=question.id) else: form = AnswerForm() context = {'question': question, 'form': form} return render(request, 'pybo/question_detail.html', context) {% extends 'base.html' %} {% block content %} <div class="container my-3"> <h2 class="border-bottom py-2">{{ question.subject }}</h2> <div class="card my-3"> <div class="card-body"> <div class="card-text" style="white-space: pre-line;">{{ question.content }}</div> <div class="d-flex justify-content-end"> <div class="badge badge-light p-2"> {{ question.create_date }} </div> </div> </div> </div> <h5 class="border-bottom my-3 py-2">{{question.answer_set.count}}개의 답변이 있습니다.</h5> {% for answer in question.answer_set.all %} <div class="card my-3"> <div class="card-body"> <div class="card-text" style="white-space: pre-line;">{{ answer.content }}</div> <div class="d-flex justify-content-end"> <div class="badge badge-light p-2"> {{ answer.create_date }} </div> </div> </div> </div> {% endfor %} <form action="{% url 'pybo:answer_create' question.id %}" method="post" class="my-3"> {% csrf_token %} {% if form.errors %} <div class="alert alert-danger" role="alert"> {% for field in form %} {% if field.errors %} <strong>{{ field.label }}</strong> {{ field.errors }} {% endif %} {% endfor %} </div> {% endif %} <div class="form-group"> <textarea name="content" id="content" class="form-control" rows="10"></textarea> </div> <input type="submit" value="답변등록" class="btn btn-primary"> </form> </div> {% endblock %} - 한준규님, 2021년 10월 8일 9:56 오전 추천 , 대댓글

죄송합니다 양식에 맞춰 올려야한다는 글을 미처 보지못했습니다. 아래 answer_create 함수와 question_datail 템플릿 올리겠습니다

def answer_create(request, question_id):
    """
    답변등록
    """
    question = get_object_or_404(Question, pk=question_id)
    if request.method == 'POST':
        form = AnswerForm(request.POST)
        if form.is_valid():
            answer = form.save(commit=False)
            answer.create_date = timezone.now()
            answer.question = question
            answer.save()
            return redirect('pybo:detail', question_id=question.id)
    else:
        form = AnswerForm()
    context = {'question': question, 'form': form}
    return render(request, 'pybo/question_detail.html', context)
{% extends 'base.html' %}
{% block content %}
<div class="container my-3">
    <h2 class="border-bottom py-2">{{ question.subject }}</h2>
    <div class="card my-3">
        <div class="card-body">
            <div class="card-text" style="white-space: pre-line;">{{ question.content }}</div>
            <div class="d-flex justify-content-end">
                <div class="badge badge-light p-2">
                    {{ question.create_date }}
                </div>
            </div>
        </div>
    </div>
    <h5 class="border-bottom my-3 py-2">{{question.answer_set.count}}개의 답변이 있습니다.</h5>
    {% for answer in question.answer_set.all %}
    <div class="card my-3">
        <div class="card-body">
            <div class="card-text" style="white-space: pre-line;">{{ answer.content }}</div>
            <div class="d-flex justify-content-end">
                <div class="badge badge-light p-2">
                    {{ answer.create_date }}
                </div>
            </div>
        </div>
    </div>
    {% endfor %}
    <form action="{% url 'pybo:answer_create' question.id %}" method="post" class="my-3">
        {% csrf_token %}
        {% if form.errors %}
        <div class="alert alert-danger" role="alert">
        {% for field in form %}
            {% if field.errors %}
            <strong>{{ field.label }}</strong>
            {{ field.errors }}
            {% endif %}
        {% endfor %}
        </div>
        {% endif %}
        <div class="form-group">
            <textarea name="content" id="content" class="form-control" rows="10"></textarea>
        </div>
        <input type="submit" value="답변등록" class="btn btn-primary">
    </form>
</div>
{% endblock %}

한준규

2021년 10월 8일 9:57 오전

Answer 모델에 create_date 가 아닌 create_data 로 컬럼을 생성하신것 같습니다. - 박응용님, 2021년 10월 8일 10:43 오전 추천 , 대댓글
@박응용님 data로 생성한 기록이 없는데, 혹시 어느파일에서 data로 생성하신거같다는 말씀이신지 알수있을까요? - 한준규님, 2021년 10월 8일 1:16 오후 추천 , 대댓글
@한준규님 models.py 파일의 Answer 클래스의 속성으로 create_date 가 되어야 하는데 create_data 로 하신것 같습니다. - 박응용님, 2021년 10월 8일 2:04 오후 추천 , 대댓글