본문 바로가기

Python

(52)
Two Scoops of Django 1.8 원서 / 2020.04.12 공부 시작 Django에 대한 얕은 공부를 끝내고, 좀더 심화된 장고 프로젝트 구축과 코딩 스타일에 대해 공부해보고자 시작! 고민은 너무 깊게 하지 않는다. 고민만 하다간 시작도 하지 못하기 때문이다. 일단 저지르기!
[Django REST framework] 6. ViewSets & Routers https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/ 6 - Viewsets and routers - Django REST framework REST framework includes an abstraction for dealing with ViewSets, that allows the developer to concentrate on modeling the state and interactions of the API, and leave the URL construction to be handled automatically, based on common conventions. ViewSet c www.django-rest-frame..
[Django REST framework] 5. Relationships & Hyperlinked APIs https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/ 5 - Relationships and hyperlinked APIs - Django REST framework At the moment relationships within our API are represented by using primary keys. In this part of the tutorial we'll improve the cohesion and discoverability of our API, by instead using hyperlinking for relationships. Right now we have endpoints for..
[Django REST framework] 4. Authentication & Permissions https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/ 4 - Authentication and permissions - Django REST framework Currently our API doesn't have any restrictions on who can edit or delete code snippets. We'd like to have some more advanced behavior in order to make sure that: Code snippets are always associated with a creator. Only authenticated users may create snipp w..
[Django REST framework] 3. Class-based Views https://www.django-rest-framework.org/tutorial/3-class-based-views/ 3 - Class based views - Django REST framework We can also write our API views using class-based views, rather than function based views. As we'll see this is a powerful pattern that allows us to reuse common functionality, and helps us keep our code DRY. We'll start by rewriting the root view as a cla www.django-rest-framework.o..
[Django REST framework] 2. Requests and Responses https://www.django-rest-framework.org/tutorial/2-requests-and-responses/#request-objects 2 - Requests and responses - Django REST framework From this point we're going to really start covering the core of REST framework. Let's introduce a couple of essential building blocks. REST framework introduces a Request object that extends the regular HttpRequest, and provides more flexible request pars w..
[Django REST framework] 1. Serialization https://www.django-rest-framework.org/api-guide/serializers/ Serializers - Django REST framework www.django-rest-framework.org https://www.django-rest-framework.org/tutorial/1-serialization/#setting-up-a-new-environment 1 - Serialization - Django REST framework This tutorial will cover creating a simple pastebin code highlighting Web API. Along the way it will introduce the various components th..
[Django Channels 2.4.0] Building simple Chat Server / 채팅 서버 구현 튜토리얼 part.3 Rewrite Chat Server as Asynchronous 비동기적으로 동작하게 Consumer 수정 Synchronous consumers은 어떤 특별한 코드 없이 Django models에 접근할 수 있는 등, regular synchronous I/O functions을 호출할 수 있기에 편리하다는 장점이 있다. 반면에, Asynchronous consumers은 request를 다룰 때, 추가적인 threads를 만들 필요가 없기에 higher level of performance를 제공한다. ChatConsumer은 async-native libraries(Channels and the channel layer)만을 사용하고, synchronous Django models에 접근하지 않는다. 그렇기에, 특별한 문제없이 asynchronous하게 바꿀 수..