-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
로그아웃을 누르는 화면을 패스하는 방법은 없나요?
19.12.05 11:30 작성 조회수 95
0
로그아웃 버튼을 누르게되면
/accounts/logout으로 연결되고
해당 페이지에서 sign out을 눌러야 로그아웃인데
해당 페이지를 꾸미거나 그냥 패스하는 방법은 따로 설명이 없나요?
답변을 작성해보세요.
0
SungYong Lee
지식공유자2019.12.07
안녕하세요. 다른 분도 질문을 하셨어서 아래에 정리를 좀 해봤습니다.
settings.py 수정
원래는 DIRS가 비어 있는데, 여기에 아래와 같이 추가한다.
TEMPLATES = [
{
'BACKEND': 'django.template.backends. django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'allauth_templates')],# <- 이 부분!
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_ processors.debug',
'django.template.context_ processors.request',
'django.contrib.auth.context_ processors.auth',
'django.contrib.messages. context_processors.messages',
],
},
},
]
프로젝트 루트 폴더에 allauth_templates 폴더 추가
allauth_templates 라는 폴더도 templates 폴더라고 선언한 것이니, 프로젝트 루트폴더(즉, db.sqlite3와 manage.py가 있는 폴더)에 allauth_templates 폴더를 새로 추가한다.
venv 폴더에서 allauth templates를 복사하기
venv/Lib/site-packages/allauth 폴더에 보면, templates라는 폴더가 있다.
여기에는 세개의 폴더(account, openid, socialaccount)와 하나의 파일(base.html)이 있다. 여기에 있는 파일들이 allauth의 html 파일이기 때문이다.
이걸 모두 복사해서 allauth_templates 폴더에 복사한다. 장고는 이제 이 복사한 폴더의 html 파일을 우선적으로 사용한다. 그러므로, 이 파일들을 수정하면 반영이 된다.
답변 1