CRUD 중 Create - (login view) - R - U - D
path('login/', LoginView.as_view(template_names='accountapp/login.html), name='login'),
path('logout/', LogoutView.as_view(), name='logout'),
-> 계정 생성 후 로그인 시도하면 accounts/profile 로 이동하게 됌 (기본설정)
-next={{ request.path }} : 맨 처음인 next로 가기위한 인자
{% if not user.is_authenticated %} #로그인 안되어 있으면
<a href=" url 'accountapp:login'?next={{ request.path }} ">
<span>login</span>
</a>
{% else %}
<a href=" url 'accountapp:logout'?next={{ request.path }} ">
<span>logout</span>
</a>
{% endif %}
오류 방지 (settings.py)
LOGIN_REDIRECT_URL = reverse_lazy('accountapp:hello_world')
LOGOUT = reverse_lazy('accountapp:login')