{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/django-rest-framework/django-to-drf/",
    "result": {"data":{"site":{"siteMetadata":{"title":"Today I Learned"}},"markdownRemark":{"id":"3f7095cb-470c-5499-90f7-3fa025e3949e","excerpt":"0. 서론 재고관리 프로젝트 코드 리팩토링 과정중 가장 먼저 drf 로 마이그레이션 하는것을 선택했다. 효율성을 위해 프론트와 백엔드를 구분하고 코드 재사용을 위한 선택이였다. 1. 시작하기 전 API 에서는 Json…","html":"<h2>0. 서론</h2>\n<p>재고관리 프로젝트 코드 리팩토링 과정중 가장 먼저 drf 로 마이그레이션 하는것을 선택했다.<br>\n효율성을 위해 프론트와 백엔드를 구분하고 코드 재사용을 위한 선택이였다.</p>\n<h2>1. 시작하기 전</h2>\n<p>API 에서는 Json 데이터를 리턴하고 프론트엔드 프레임워크에서 리턴받은 데이터를 보여주면 되겠다고 생각했다.<br>\n당장 프론트엔드 프레임워크를 배우긴 힘들어서 방법에 대해 고민을 하던중 drf 공식문서에서 html 을 리턴하는것에도 적합하다는 내용을 보고 바로 시작했다.</p>\n<h2>2. 첫 시도</h2>\n<ul>\n<li>drf 공식 문서를 참고하여 데이터와 함께 <code class=\"language-text\">business_list.html</code> 을 리턴했다. 간단했지만 페이징이 불가능했다.</li>\n<li>페이징 방법을 찾다가 <code class=\"language-text\">ViewSet</code> 과 <code class=\"language-text\">Serializer</code> 를 알게되어 사용해보았지만 잘 되지 않았다.</li>\n<li><code class=\"language-text\">routers</code> 도 사용했는데 URL name 이 <code class=\"language-text\">{basename}-list</code> 형식으로 생성되지 않는것 같았다.</li>\n</ul>\n<p>어느 하나 내가 원하는 대로 되지 않아서 커밋되지 않은 변경 사항을 모두 버리고 다시 생각해보기로 했다.<br>\n그리고 프론트, 백엔드가 구분되어야 하기 때문에 drf 를 사용하지 않을수 없다는 결론을 내렸다.</p>","frontmatter":{"title":"장고에서 drf 로 마이그레이션 시도","date":"March 16, 2022","description":null},"fields":{"category":"django-rest-framework","slug":"/django-rest-framework/django-to-drf/"}},"previous":{"fields":{"slug":"/oop/oop-essential/"},"frontmatter":{"title":"객체지향 개념 기초"}},"next":{"fields":{"slug":"/front-end/npm-and-yarn/"},"frontmatter":{"title":"npm 과 yarn. 정의하고 선택해보기."}}},"pageContext":{"id":"3f7095cb-470c-5499-90f7-3fa025e3949e","previousPostId":"4fa506ca-c981-5458-b47c-00feaf9aa121","nextPostId":"76bff6e3-8cea-57f7-aac4-9188ad1553b7"}},
    "staticQueryHashes": ["230163734","2841359383","3496359572"]}