본문 바로가기

개발일지/TIL

TIL 23-05-22 머신 러닝 팀 프로젝트

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를 수정하면 되는 것을 똑같은 상태에서 받으려고 하니 이상한 해결방법이 튀어나왔다.