https://www.notion.so/S-A-6d0bb0641d6c477b9ef065756d13426d
S.A.
프로젝트 컨셉
www.notion.so
1. DRF 팀 프로젝트 - black formater 적용하기




알게 된 점
새 팀프로젝트를 시작하며 settings.json을 더 알게됐다.
1. django urls 수정 하기
문제점
re_path를 사용해서 매개변수 문제를 해결했지만, 너무 복잡해서 이게 맞는지 의문
시도해 본 것들
re_path(
r"^[0-9]+/comments/$",
views.CommentView.as_view(),
name="comment_view",
),
re_path(
r"^/comments/(?P<comment_id>[0-9]+)/$",
views.CommentView.as_view(),
name="comment_view",
),
해결 방법
path("<int:article_id>/comments/", views.CommentView.as_view(), name="comment_view"),
path("comments/<int:comment_id>/", views.CommentView.as_view(), name="comment_view"),
postman에서
{{host}}/2/comments/6/
이게 아니라
{{host}}/comments/6/
이렇게 받으면 바로 해결 됐다.
알게 된 점
ulrs를 수정하면 되는 것을 똑같은 상태에서 받으려고 하니 이상한 해결방법이 튀어나왔다.
'개발일지 > TIL' 카테고리의 다른 글
TIL 23-05-24 머신러닝 프로젝트 - git commit --amend (0) | 2023.05.24 |
---|---|
TIL 23-05-23 머신러닝 팀 프로젝트 - poetry&pyenv 사용하기 (0) | 2023.05.23 |
TIL 23-05-21 백준 - 소수 구하기 (에라토스테네스의 체) (0) | 2023.05.21 |
TIL 23-05-20 django - urls re_path사용하기, view 통합하기 (2) | 2023.05.20 |
TIL 23-05-19 프로그래머스 기초 트레이닝 - lambda 사용하기 (0) | 2023.05.19 |