분류 전체보기 (27) 썸네일형 리스트형 Django-environ 패키지를 활용한 Django 환경변수 설정 django-environ 패키지는 장고 애플리케이션에 필요한 환경변수를 .env파일에 따로 구성할 수 있도록 해준다. django-environ을 사용한 django의 settings.py의 예제다. import os from pathlib import Path import environ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent env = environ.Env() ENV_MODE = env.str("ENV_MODE", "local") env_file = ".env.{}".format(ENV_MODE) # Take environment var.. DRF token-based vs session based authentication Token-based authentication in Django Rest Framework uses tokens (string) to authenticate clients, while session-based authentication uses sessions (a more complex structure) to authenticate clients. In token-based authentication, the client sends an API request with a token in the header, and the server verifies the token to determine if the client is authenticated. Tokens can be revoked, making.. django allowed hosts invaild host header elb alb django Allowed hosts with aws elb 아래와 같이 쓰여져 있는데 회사에서는 ECS를 사용하고 있으므로 ECS의 프라이빗IP를 설정해줘야한다. 문제는 deploy될 때 프라이빗 IP가 바뀐다는 것이다. 이는 장고가 들어있는 컨테이너를 deploy를 하고 나서 ip를 알수 있을테니, 처음부터 정확한 프라이빗 ip를 장고의 allowed hosts에 설정하는 것은 지금으로서는 방법이 떠오르지 않는다. 취할 수 있는 해결책으로는 아래의 3개다. 프라이빗ip의 액세스를 허가하는 것. → 책이 오면 판단한다. 구니콘이나 nginx, elb등에서 제어할수 있을지도? ecs의 컨테이너에 route53으로 프라이빗 도메인을 설정하고 elb에서 health check할때 프라이빗 ip가 아닌, 프라.. 이전 1 2 3 4 다음