TIL( Today I Learned)
-
21-09-13 월
- Modeling 정리한 내용 문서화 하기
-
Prj 정리내용 문서화
- framework : Django
- ORM: Django
- Serialier : DRF-Serializer
-
View : class View(APIView)
- Permission 에 따라 접근 제한 처리
- Req Valid : Input Serializer
- Resp Form : Output Serializer
- Path Param Valid: Path Param 자체 형식
- Query Param Valid : django-filter
-
Documentation : drf-yasg
- require, Response(serializer.data)
- Header Valid : middleware CG, SG 분기
-
Coding Style 틀 잡고 이슈내용 생길 때 마다 추가해나가기
- Naming Rule
- Do
- Dont
-
Authorization : drf-oauth-toolkit
-
1차 auth, service api/ 단일 App 처리
- F: app-domain/api/auth 요청
- B: Token발급
- F: Request app-domain/service with Token
- B: Auth Pass, process API
-
2차 auth, service api/ 분리 독립 App 처리
- Frond: app-domain/api/auth 요청
- Back: request to auth-domian/api/auth
- AuthBack : Issue Token
- B: Deliver Issued Token
- F: Request app-domain/service with Token
- B: request to auth-domian/api/auth
- AB : Check authorization
- B : Process API
-
- test framework : pytest
-
CI Process 추가 :
-
pre-commit hook
- black
- isort
- commitizen
-
- Dependency Management : poetry
21-09-14 화
- 로직 구조 점검하기
- settings.py
-
db managing
-
방법
- DB 별로 app 분리
- python manage.py —app sellergate —database sellergate
-
create
-
local
- => migrate
- ./manage.py makemigrations gate —settings=tac.settings.local
-
dev
- => migrate
-
prod
- Dont do anything
-
-
update
-
local
- => migrate
-
dev
- => migrate
-
prod
- not at all
-
-
-
db settings
- local SQL dumps
- Develop clone
21-09-15 수
- Django multiDB test setting
21-09-16 목
- pytest 빨리 하기
-
Pytest 왜 쓰레드, 프로세스 안됨?
- but make sure that your code does not rely on anything bound to threads (like database connections) when you do.
-
django
- db routing 생각해보기
21-09-17 금
- readme 작성
-
viewset 추가하기
- GenericViewset
- Modelviewset? => 제외, default query set 지정되어 있음.?
- ViewSet?
TEL (Trial and Error Log)
21-09-14
-
ERROR: models.E028
- SITUATION: Django throws error when different apps with different models have the same name table name.
- REASON: multi name on db
- SOLUTION: add DATABASE_ROUTER
21-09-16
-
ERROR: all, any 구분
- SITUATION: conditional situation
-
REASON:
- all (all True)의 반대는 all False 가 아님
- any(any True) 의 반대는 any False가 아님
-
SOLUTION:
- all = 모든 값이 True
- any = 하나라도 True
- not all = 모든 값이 False
- not any = 하나라도 False
21-09-17
-
ERROR: settings.DATABASES is improperly configured. Please supply the ENGINE value
- SITUATION: django requeste
- REASON: django using을 생략
-
SOLUTION:
- using(“db”) 명시