WEB/Django 5

[Django] Django-waffle을 이용하여 Feature Flag 사용하기

1. Feature Flag 란 Feature Flags are software switches that turn on or off a feature - usually in real-time, without needing to release a new version of the software. For instance, if you are shipping a new feature and you want to be able to control who gets to see your new feature and who shouldn’t, then you use Feature Flags to accomplish that. Feature toggle/ Feature switch 라고도 불리는 Feature Fla..

WEB/Django 2021.10.27

[Swagger(Redoc) + Django] Request samples, Response samples 직접 입력하기

요즘 바빠서 블로그 글쓰는걸 까먹고 있다가 오늘 삽질을 너무 오래해서 글을 하나 쓴다. 1. 문제 상황 스웨거와 리독을 자동으로 연결 해놨는데 CBV 기반의 코드들만 request example과 response example 이 안뜨는 것을 확인했다. 정상 상황 문제 상황 보면 오른쪽 까만 화면에 에제 데이터가 떠야 되는데 안뜸을 알 수 있다. 2. 해결 방법 2-1. Response samples 만들기 - 우선 swagger_auto_schema와 openapi를 import 한다. - 예제 데이터가 담긴 response_schema_dict(예시 이름) 을 만든다 - 아래 코드의 "key" : "value" 란에 예제 데이터를 담으면 된다. from drf_yasg.utils import swag..

WEB/Django 2021.07.17

[Django View] Postman 사용하여 api 주고 받기

1. Postman 1.1 Postman 이란 더보기 A powerful GUI platform to make your API development faster & easier, from building API requests through testing, documentation and sharing. 즉, API request를 만들어서 Api를 테스트 해볼 수 있는 프로그램이다. 포스트 맨을 사용하기 위해선 노트북에 설치 해주는 게 간단한데, (굳이 설치 안하고 웹페이지에서도 할 수는 있다. ) 설치는 다음 링크에서 하면 된다. www.postman.com/downloads/ Download Postman | Try Postman for Free Try Postman for free! Join 13..

WEB/Django 2021.05.06

[Django] instagram 모델 생성 및 Migration 해보기

REST API 서버 개발 인스타그램 클론 모델 설명 작성한 모델 1. User : 장고에서 지원하는 AbstractBaseUser를 상속받고 있는 모든 유저를 담은 모델 class User(AbstractBaseUser): username= models.CharField(max_length=255) USERNAME_FIELD = 'username' insta_id = models.CharField(max_length=255, unique=True, ) is_professional = models.BooleanField(default=False) username : 사용자의 이름을 담고 있다. AbstractBaseUser를 상속할때 필수로 들어가야 하는 정보 insta_id : 인스타 아이디 인스타 아..

WEB/Django 2021.03.24