How can I get {% url logout %} to work in my Django template?
django, django-templates
Solution
You didn't include `django.contrib.auth`'s URLs in your `urls.py`, so there is no logout URL.
Try adding something like
url(r'^auth/', include('django.contrib.auth.urls')),
Problem
My Django app's site-wide urls.py file looks like this: ``` urlpatterns = patterns('', url(r'^$', include('myApp.urls')), url(r'^admin/', include(admin.site.urls)), url ( r'^accounts/register/$', RegistrationView.as_view(form_class=extendedRegistrationForm), ), url(r'^accounts/', include('registration.backends.default.urls')), url(r'^', include('myApp.urls')), ) ``` I also have a urls.py specific to myApp but I have not shown that here because I don't think it's relevant. In my template file, I have this: ``` {% url logout %} ``` It gives me this error: ``` 'url' requires a non-empty first argument. The syntax changed in Django 1.5, see the docs. ``` When I change the template to: ``` {% url 'logout' %} ``` It gives me the following error: ``` Reverse for 'logout' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] ``` How do I put a link to logout in my view?