본문 바로가기

전체 글

(1835)
[Django]Survey WEB Application Tutorial 6 1. 테스트 소개 - 테스트를 통해 시간을 절약 https://docs.djangoproject.com/ko/3.0/intro/tutorial05/#tests-will-save-you-time 첫 번째 장고 앱 작성하기, part 5 | Django 문서 | Django Django The web framework for perfectionists with deadlines. Overview Download Documentation News Community Code Issues About ♥ Donate docs.djangoproject.com - 테스트는 문제를 그저 식별하는 것이 아니라 예방합니다. https://docs.djangoproject.com/ko/3.0/intro/tutorial05/#..
[Django]Survey WEB Application Tutorial 5 1. Form 포함 ''' polls/templates/polls/detail.html ''' {{ question.question_text }} {% if error_message %}{{ error_message }}{% endif %} {% csrf_token %} {% for choice in question.choice_set.all %} {{ choice.choice_text }} {% endfor %} - 위의 템플릿은 각 질문 선택 항목에 대한 라디오 버튼을 표시합니다. 각 라디오 버튼의 value는 연관된 질문 선택 항목의 ID입니다. 각 라디오 버튼의 name은 "choice"입니다. 즉, 누군가가 라디오 버튼 중 하나를 선택하여 폼을 제출하면, POST 데이터 인 choice=#을 보..
[Django]'polls" is not a registered namespace Error Django Tutorial 도중 발생한 namespace Error가 있다. 이를 해결 하기 위한 방법이 있다. Error Massge> NoReverseMatch at 'polls" is not a registered namespace Request Method: Request URL: Django Version: Exception Type: Exception Value: 'polls" is not a registered namespace Exception Location: Python Executable: Python Version: Python Path: Server time: Error during template rendering In template , error at line 5 'poll..
[Django]Survey WEB Application Tutorial 4 1. 설계 계획 수립 질문 "색인" 페이지 -- 최근의 질문들을 표시합니다. 질문 "세부" 페이지 -- 질문 내용과, 투표할 수 있는 서식을 표시합니다. 질문 "결과" 페이지 -- 특정 질문에 대한 결과를 표시합니다 투표 기능 -- 특정 질문에 대해 특정 선택을 할 수 있는 투표 기능을 제공합니다. 2. 뷰 추가 ''' polls/views.py ''' def detail(request, question_id): return HttpResponse("You're looking at question %s." % question_id) def results(request, question_id): response = "You're looking at the results of question %s." ret..
[Django]Survey WEB Application Tutorial 3 1. __str__() 메소드를 Question과 Choice에 추가 객체의 표현을 대화식 프롬프트에서 편하게 보려는 이유 말고도, Django 가 자동으로 생성하는 관리 사이트 에서도 객체의 표현이 사용 ''' polls/models.py ''' from django.db import models class Question(models.Model): # ... def __str__(self): return self.question_text class Choice(models.Model): # ... def __str__(self): return self.choice_text 1-1. Model.__str__() ''' Model.__str__() Example ''' from django.db impo..
[Django]Survey WEB Application Tutorial 2 1. Setting.py 데이터베이스 확인 ''' mysite/settings.py ''' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } 1-1. 관련된 명령어 # 데이터베이스에 변경 필요 사항 추출 python manage.py makemigrations # 데이터베이스에 변경사항 반영 python manage.py migrate 1-2. DBdb.sqlite3 2. TimeZone 설정 ''' mysite/settings.py ''' TIME_ZONE = 'Asia/Seoul' 3. 언어 설정 LANGUAGE_CODE = 'ko-kr' 4...
[Django]Survey WEB Application Tutorial 1 1. 가상 환경 생성 python -m venv venv 2. Django 설치 pip install django 3. Django Ver 확인 py -m django --version 4. 프로젝트 만들기 4-1. 기본 명령어 django-admin startproject name [directory] 4-2. 현재 폴더에 프로젝트 만들기 django-admin startproject mysite . 4-3. mysite 폴더 생성 후 프로젝트 만들기 django-admin startproject mysite 5. 프로젝트 생성 확인 mysite/ manage.py mysite/ __init__.py settings.py urls.py asgi.py wsgi.py mysite/ 프로젝트의 컨테이너 ma..
db.sqlite3 db.sqlite3> SQLite3 데이터베이스 파일 DB 관련 명령어> 1. 데이터베이스에 변경 필요 사항 추출 python manage.py makemigrations 2. 데이터베이스에 변경사항 반영 python manage.py migrate