Running into a strange django error:
“Reverse for ” with arguments ‘()’ and keyword arguments ‘{}’ not found. ”
This error appeared mysteriously when porting a working project from one computer to another. The first computer was running Python 2.7.1, the second – Python 2.7.2. All other project settings were identical.
For the original computer (Python 2.7.1), the following settings:
base.html
:
<a href="{% url 'display_rulelist' %}"><span class="numbertxt"> Rule List </span>
urls.py
:
url(r'^rulelist/$', rulelist.views.display_rulelist, name = 'display_rulelist')
worked correctly, with no errors. These did NOT work for Python 2.7.2!
For the new computer (Python 2.7.2),
base.html
:
<a href="{% url display_rulelist %}"><span class="numbertxt"> Rule List </span>
removing the apostrophes solved the problem.
I tried going back to the first version and removing the apostrophes as well, but after making the change – the first project no longer worked.
All I can recommend: when running into this error, try both versions!
EDITED:
It was pointed out to me (see comments below) that the url formatting was updated between django 1.4.x and django 1.5. I had completely overlooked that the django versions were different, but so they were: the first project had run django 1.5, and the second: django 1.4.3. Beware of old django versions, users-who-work-on-more than one computer! BEWAAAARE!
Filed under: django, python | Tagged: django, python, templates | 2 Comments »