1

我將項目從1.1遷移到1.2,然後遷移到1.3,所有這些完美無瑕。然而,當我移動版本高達1.4,我不斷收到一個NoReverseMatch django 1.4管理

NoReverseMatch at /admin/<app_name>/<model_name>/ 
Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': ''}' not found. 

所有其他管理功能似乎很好地工作,但每次我嘗試看看名單,我得到這個NoReverseMatch錯誤。

我對管理URL條目是:

(r'^admin/', include(admin.site.urls)), 

這裏是我的回溯:

Template error: 
In template /home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/contrib/admin/templates/admin/change_list.html, error at line 44 
    Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': ''}' not found. 
    34 : </script> 


    35 : {% endif %}{% endif %} 


    36 : {% endblock %} 


    37 : 


    38 : {% block bodyclass %}change-list{% endblock %} 


    39 : 


    40 : {% if not is_popup %} 


    41 : {% block breadcrumbs %} 


    42 : <div class="breadcrumbs"> 


    43 : <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> 


    44 : &rsaquo; <a href=" {% url 'admin:app_list' app_label=cl.opts.app_label %} ">{{ app_label|capfirst|escape }}</a> 


    45 : &rsaquo; {{ cl.opts.verbose_name_plural|capfirst }} 


    46 : </div> 


    47 : {% endblock %} 


    48 : {% endif %} 


    49 : 


    50 : {% block coltype %}flex{% endblock %} 


    51 : 


    52 : {% block content %} 


    53 : <div id="content-main"> 


    54 :  {% block object-tools %} 


Traceback: 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response 
    136.      response = response.render() 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/response.py" in render 
    104.    self._set_content(self.rendered_content) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/response.py" in rendered_content 
    81.   content = template.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in render 
    140.    return self._render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in _render 
    134.   return self.nodelist.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in render 
    823.     bit = self.render_node(node, context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/debug.py" in render_node 
    74.    return node.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/loader_tags.py" in render 
    123.   return compiled_parent._render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in _render 
    134.   return self.nodelist.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in render 
    823.     bit = self.render_node(node, context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/debug.py" in render_node 
    74.    return node.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/loader_tags.py" in render 
    123.   return compiled_parent._render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in _render 
    134.   return self.nodelist.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in render 
    823.     bit = self.render_node(node, context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/debug.py" in render_node 
    74.    return node.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/defaulttags.py" in render 
    281.     return nodelist.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in render 
    823.     bit = self.render_node(node, context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/debug.py" in render_node 
    74.    return node.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/loader_tags.py" in render 
    62.    result = block.nodelist.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/base.py" in render 
    823.     bit = self.render_node(node, context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/debug.py" in render_node 
    74.    return node.render(context) 
File "/home/ibustama/yalea/env-yalea/lib/python2.6/site-packages/django/template/defaulttags.py" in render 
    424.       raise e 

Exception Type: NoReverseMatch at /admin/auth/user/ 
Exception Value: Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': ''}' not found. 
+1

看來你忘了在你的'INSTALLED_APPS'配置中包含一個應用程序。您是否按照[這些](https://docs.djangoproject.com/en/dev/intro/tutorial02/#activate-the-admin-site)步驟使用管理頁面? – marianobianchi

+0

嗨,謝謝,我確實按照這些步驟。我想,也許我錯過了設置文件中的一些新的默認應用程序,甚至檢查了訂單。問題依然存在。無論如何,我發現這個問題(而且很愚蠢),所以我會發布答案。 – ibustama

回答

0

我的錯誤是在末尾,而愚蠢的。我的一個自定義上下文處理器重新定義了「瘦肉精」上下文變種,因此使下面的標記失敗:

{% url 'admin:app_list' app_label=cl.opts.app_label %} 

我不得不作出一些改變,以我自己的背景處理器和模板(以及採用更好的背景處理器變種名稱)。

注:我不知道爲什麼這之前沒有打擾過我。從理論上講,即使是1.1,它也應該是個問題。