Debugging Django {% url %} tag

When you sometimes notice that {% url %} tag does not work for your named urls, then debugging it is easy. Start the python shell:

import app.views
from django.core.urlresolvers import reverse
reverse('named-view-to-be-tested')

If the view doesn’t work, it will either return NoReverseMatch: Not enough positional arguments passed in exception or url.

Thanks to jodal from #django for the tip.

Tags: ,

Leave a Reply