Django Session 충돌

king_co_king·2022년 11월 4일
0

같은 도메인으로 다른 포트를 사용하여 여러 서버를 실행했을 때, 관련 설정을 바꿔주지 않으면 Django가 사용하는 기본 Session 이름이 같아 충돌이 나게됨.


  • setting.py에 다음을 추가하여, 각 서버마다 임의로 세션 이름 변경
CSRF_COOKIE_NAME = '{변경할 CSRF토큰명}'
SESSION_COOKIE_NAME = '{변경할 Session아이디명}'

CSRF_COOKIE_NAME
Default: 'csrftoken'
The name of the cookie to use for the CSRF authentication token. This can be whatever you want (as long as it’s different from the other cookie names in your application).

SESSION_COOKIE_NAME
Default: 'sessionid'
The name of the cookie to use for sessions. This can be whatever you want (as long as it’s different from the other cookie names in your application).

profile
난 왕코딩왕. 바퀴는 이미 발명됐다. 난 백미러를 만드는 사람.

0개의 댓글