python - Django logout makes trouble with the error : Reverse for 'logout' with arguments '()' and keyword arguments '{}' not found -
my error below :
reverse 'logout' arguments '()' , keyword arguments '{}' not found
my 'urls.py' below :
urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$',homeview.as_view(), name='home'), url(r'^about/$',aboutview.as_view(), name='about'), url(r'^login/$', views.loginview, name='login'), url(r'^inquiry/$',inquiryview.as_view(), name='inquiry'), url(r'^service_terms/$',servicetermsview.as_view(), name='service_terms'), url(r'^privacy_terms/$',privacytermsview.as_view(), name='privacy_terms'), url(r'^logout/$,', views.logoutview, name='logout'), ]
my 'views.py' below:
@login_required def logoutview(request): if request.method == 'post': logout(request) print('logout done') return render(request, 'about.html')
my code logging out in 'navbar.html' below:
<li><a href="{% url 'logout' %}">logout</a></li>
i totally not understand i'm missing. there i'm doing wrong?
you have comma in regex shouldn't there. replace
url(r'^logout/$,', views.logoutview, name='logout'),
with
url(r'^logout/$', views.logoutview, name='logout'),
Comments
Post a Comment