728x90
반응형
1. 모듈 설명
- dao : DB에 sql을 보내는 메서드
- connectionUtils.py : postgreSQL 연결 Connection 생성
- todoDAO : todoDTO 객체를 통해 DB에 sql문으로 기능 수행 CRUD(create, read, update, delete)
- memberDAO : id, password를 받아 일치한다면 memberDTO 반환
- dto
- todoDTO : todo 객체(tno, title, dueDate, finished)
- memberDTO : member 객체(mid, mpw, mname)
- templates : view 부분
- list.html : 목록 페이지
- login.html : 로그인 페이지
- register.html : todo 등록 페이지
- read.html : todo 세부 페이지
- modify.html : todo 수정 페이지
- main.py : 컨트롤러(view 부분에 jinja2로 html에 접근해 get, post방식으로 자료 교환)
- "/todo/read", "/todo/modify", "/todo/delete" 추가
2. 필요한 라이브러리 설치:
pip install fastapi uvicorn psycopg2 jinja2
- fastapi : fastAPI
- uvicorn : fastAPI 서버 구동
- psycopg2 : postgtrSQL 연결
- jinja2 : HTML 렌더링
3. 깃허브 링크
https://github.com/cbjh-4/TodoList_python/tree/add_login_logout_session
4. 실행 화면



5. 어려웠던 점
- 세션 처리가 익숙치 않아 어려웠다.
- 시간이 많지 않아 간단하게 로그인 하면 세션을 생성하고 로그아웃하면 loginInfo 세션을 지우는 기능만 추가했다.
'프로젝트 > Python - FastAPI' 카테고리의 다른 글
[Python_FastAPI] TodoList#5 세부 페이지, 수정, 삭제 기능 추가 (0) | 2024.05.03 |
---|---|
[Python_FastAPI] TodoList#4 모듈화, 글 등록 DB 연동 (0) | 2024.05.03 |
[Python_FastAPI] TodoList#3, FastAPI로 html 렌더링(연결), postgreSQL DB연결 (0) | 2024.05.02 |
[Python_FastAPI] TodoList#2, 파이썬 FastAPI로 html 렌더링(연결) (0) | 2024.05.02 |
[Python_FastAPI] TodoList#1, 파이썬 FastAPI로 html 렌더링(연결) (0) | 2024.05.02 |
댓글