NoReverseMatch at /;第0行的错误

时间:2016-05-01 15:01:12

标签: django python-3.x

我收到以下错误,我不明白为什么......我发誓昨天一切正常......我正在使用python 3.5和django 1.9。我浏览了大部分NOReverseMatch帖子,但我找不到任何东西......请帮忙

"Reverse for 'xxx' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []"

In template F:\Django-tutorial\src\landing_pages\templates\landing_pages\home.html, error at line 0

home.html应显示为主页

我的项目url.py:

urlpatterns = [
url(r'^', include('landing_pages.urls')),
url(r'^admin/', admin.site.urls),
url(r'^in/', include('web_monitor.urls')),

landing_pages.urls:

from django.conf.urls import url
from landing_pages.views import home, contact, about, cost


urlpatterns = [
    url(r'^$', home, name='home'),
    url(r'^contact/$', contact, name='contact'),
    url(r'^about/$', about, name='about'),
    url(r'^cost/$', cost, name='cost'),
]

Home.html中:

{% extends 'landing_pages/base.html' %}
{% load crispy_forms_tags %}

{% block jumbotron %}
<!-- Main component for a primary marketing message or call to action -->
<div class="jumbotron">
{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-3">
        <form method="POST" action="">
            {% csrf_token %}
            {{ form|crispy }}
            <input class="btn btn-primary" type="submit" value="Submit">
        </form>
    </div>
</div>
{% endblock %}

base.html文件:

{% load staticfiles %}
<html lang="en">
<head>
    {% include 'landing_pages/head_css.html' %}
</head>

<body>
{% include 'landing_pages/nav_bar.html' %}
<div class="container">
    {% block jumbotron %}
    {% endblock %}
    {% block content %}
    {% endblock %}
</div> <!-- /container -->
</body>
</html>

nav_bar.html只是一个导航栏,我引用这样的链接:

<li><a href="{% url 'cost' %}">Cost</a></li>

0 个答案:

没有答案