November 2015
Beginner to intermediate
840 pages
26h 30m
English
NoReverseMatch ExceptionWhen URL reversal doesn’t work, Django raises a NoReverseMatch exception. In Example 6.11, we ask for a URL pattern name that doesn’t exist.
Example 6.11: Python Interpreter Code
>>> from django.core.urlresolvers import reverse >>> reverse('no_such_url_pattern')
Django outputs the stack trace for the error, as shown in Example 6.12. The important bit is at the very end of the output (formatted in the example for convenience).
Example 6.12: Python Code
django.core.urlresolvers.NoReverseMatch: Reverse for 'no_such_url_pattern' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Django could not find ...
Read now
Unlock full access