English 中文(简体)
Django url模板tag(但并非逆差)错误:Cout NoReverseMatch,同时造成
原标题:Django url templatetag (but not reverse() ) error: Caught NoReverseMatch while rendering

I m 试图使用圆顶模标:

{% url all-labs-map %}

但是,如果看一看该页,就会产生这一错误:

Caught NoReverseMatch while rendering: Reverse for  all-labs-map  with arguments  ()  and keyword arguments  {}  not found.

当我使用模板标象时:

{% url gmaps.views.all_labs %}

它只是罚款。

The URL conf:

urlpatterns = patterns( gmaps.views ,
    url(r ^lab_list/$ ,  all_labs , name="all-labs-map" ),
)

我尝试利用Django炮弹,看看看是否与所谓的URL存在问题,但还是使用URL。

reverse( all-labs-map ) 

页: 1

任何关于正在发生什么的想法?

感谢!

Majd

EDIT:

我在乌普恩图使用django 1.2,配备了 n子服务器和枪角和虚拟机。 我对一个图书馆负荷的习俗标签有另一个麻烦,但是,即使使用正确的标签登记表的yn子,tag本身也没有得到承认。 任何想法都会受到高度赞赏。

最佳回答

谷歌成果仍然很高,但没有人正确回答。 关键是:

{% load url from future %}

Prior to Django 1.3, this was the syntax for the url templatetag:

{% url view_name arg1 %}

在Django 1.5,这将是:

{% url "view_name" arg1 %}

从Django 1.3开始,旧版本的运行,但给您留下了解释性警告,把你引向{% 装载率从未来%},转而使用该模板的新版本,为Django 1.5做准备。

问题回答

您是否试图以这样的话写上王位:

{% url "all-labs-map" %}

{% url  all-labs-map  %}

I ve had some problems with URLs once and this seemed to help. Also regarding @user608133 comment - you need to restart gunic或n rather than nginx, as nginx is just a proxy...

如果你有另一ur,其名称与需要多个参数的同一名称相重,就可能发生这一错误。 在你整个项目中,是否发现任何重复?





相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

热门标签