nikolas nikolas - 1 year ago 352
Python Question

NoReverseMatch in Django 1.10

Here is my

from django.conf.urls import url
from django.contrib import admin
from app import views, auth
urlpatterns = [
url(r'^$', views.index, name = 'index'),
url(r'^login/', auth.login, name = 'login'),
url(r'^logout/', auth.logout, name = 'logout'),

When I'm using in template
<li><a href="{% url 'admin' %}">Administration</a></li>
get error

NoReverseMatch at /
Reverse for 'admin' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

So can any one tell me how to solve this? Thank you very much.

Answer Source

1 . Make a in app folder and use

urlpatterns = [

and in template use

<a href="{% url 'admin:index' %}">Admin</a>


  1. Use <a href="/admin">Admin</a> and left as it is(make no changes)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download