Solving Django error ‘NoReverseMatch at’ URL with arguments ‘()’ and keyword arguments ‘{}’ not found.

Django error noreversematch at

Every Django developer encounters below error at least once in their life for sure.

Beginners spend many hours debugging the issue, jumping from question to question on Stackoverflow and posting in multiple groups on Facebook.

In this article we have tried to list all the common mistakes developer makes which leads them to above error.

What is this error:

First lets see what this error is trying to tell developer.

Django is trying to find a URL with name ‘url_name’ and it is not able to find any pattern match.

Application traverses the  file from top to bottom and match the pattern. It stops at first successful match.

Arguments ‘()’ and keyword arguments ‘{}’ means that the URL application is searching for have no arguments or keyword arguments in it.

Application tried to match against ‘n’ patterns.

Why this error:

Lets say we have below file.

In above configuration:

  • URL path is articles/<int:year>/ , like /articles/2018/
  • Function name in  file is year_archive
  • URL name is news-year-archive


Main reasons behind this error are:

1) Using wrong URL name in template html file.

For example in below template code snippet,

instead of using news-year-archive  are you using news-year-archives


2) Commented HTML code.

Django tries to parse the template tags in commented HTML code as well while trying to render the template.

If all the url template tags in your template are correct, check the commented part as well. If there is any error in commented part, remove it.

In the snippet above, application will throw the error for second line as there is no URL with name ‘ news-year-archives ‘.


3) Arguments or Keyword arguments

Make sure you are passing the correct number of Arguments or Keyword arguments in URL template tag.

As you can see in  file, URL with name ‘ news-year-archive ‘ expects an argument ‘year’ in it. If you are not passing the year in url template tag, application will throw the error. So

should be


4) Including app URL conf in project

Make sure you have included the app urls in project file.


5) Namespace

URL namespaces allow you to uniquely reverse named URL patterns even if different applications use the same URL names.

For example app1 have URL name ‘contacts’, now app2 can also have URL with same name provided we are using namespace while including URLs in project’s  file.

In the template snippet inside url  template tag, we are using namespace:url_name  syntax.


6) Incorrect RegEx

If you are using any regular pattern in your URLs, make sure it is correct.

In below URL page_number  should consist only digits (\d+).


7) Django Version

In Django 1.10, the ability to reverse a URL by its python path was removed. The named path should be used instead.


If your application is still throwing this error, comment here and we will help you sail through this.


Host your Django app for free.



(Visited 1,836 times, 1 visits today)

You must read this :

3 thoughts on “Solving Django error ‘NoReverseMatch at’ URL with arguments ‘()’ and keyword arguments ‘{}’ not found.”

  1. Using Django 2.0.6 and Python 3.6.5:

    >>>>>>> fragment:
    class Thing ( models.Model ):
    id = models.UUIDField ( primary_key=True, default=uuid.uuid1 )

    >>>>>>> fragment:
    app_name = ‘thing’
    re_path(‘^myapp/[/]?$’, views.thing_view, name=’thing-view’),

    >>>>>>>> template fragment one:
    {{ }}

    The above template gives: Reverse for ‘thing-view’ with arguments ‘(UUID(‘ed3d4a32-6aa4-11e8-8439-080027ea1a18′),)’ not found. 1 pattern(s) tried: [‘thing/thing/[/]?$’]

    template fragment two:
    {{ }}

    The above template fragment gives: Reverse for ‘thing-view’ with arguments ‘(”,)’ not found. 1 pattern(s) tried: [‘thing/thing/[/]?$’]

    If I change my to use “path” rather than “re_path”, I can get things working, but I will have some URLs clash since I cannot delimit them using “path” ( e.g. ‘^stuff[/]?$’ ).

    So how can I pass a UUID as a string to a template and have it interpreted properly on the subsequent post?

    1. I see that the anchor tags got literally interpreted (web site bug!)

      Template one has: {% url ‘environment:environment-view’ %}
      Template two has: {% url ‘environment:environment-view’ %}

Leave a Reply

Your email address will not be published. Required fields are marked *