view 작성
- [blogapp]-[views.py]를 열고, 다음과 같이 뷰를 작성합니다.
1 2 | def detail(request): return render(request, 'detail.html' ) |
url 연결
- 위에서 생성한 뷰를 url로 연결해주도록 합니다.
1 | [bloapp]-[firstProject]-[urls.py]에서 다음 코드를 추가하여 작성합니다. |
1 | path( 'blogMain/detail/' , blogapp.views.detail, name = 'detail' ), |
detail.html 확인
1 | 서버를 실행하고 주소창에 [http://127.0.0.1:8000/blogMain/detail] 를 입력하여 확인합니다. |