简体   繁体   中英

NoReverseMatch at /portal/

I have inherited a python/django web application that I am trying to get working on a new machine. On machine 1 (the original) every drop menu link works correctly and causes no errors. On machine 2, the new machine where the web application was copied to, one dropdown menu link causes the following error:

Exception Type:     NoReverseMatch
Exception Value: Reverse for 'account_index' with arguments '()' and keyword arguments '{}' not found.

The error refers to an html template file called "base-site.html". The client dropdown has identical code to the account dropdown. On machine 1 both work, on machine 2 the account one causes the error. The python app excerpts below show the code relevent to the dropdowns ...

For the account dropdown

From base-site.html:  <li><a tabindex="-1" href="{% url 'account_index' %}">Browse</a></li>
From account urls.py:  url(r'^/?$', 'account.views.account_index', name='account_index'),

For the client dropdown

From base-site.html:  <li><a tabindex="-1" href="{% url 'client_index' %}">Browse</a></li>
From client urls.py:  url(r'^$', 'client.views.client_index', name='client_index'),

Can someone suggest why the account dropdown would work on machine 1 and not on machine 2? How to solve this issue so it works on both machines? Could it be .pyc files carried over in the copy from 1 to 2?

The machine showing the error is using django 1.4 when it needs to be using django 1.5. The url template scheme changed between versions and it is not backwards compatible (unfortunately).

pip install django==1.5

Also, delete your pyc files before restarting your dev server

find . -name "*pyc" | xargs rm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM