我已经尝试了这个网站上的许多解决方案来解决这个问题,但我仍然得到错误。在这里,我放置了所有需要的信息:
视图.py:
def about(request):
return render_to_response('homepage/about.html')
网址.py:
urlpatterns = patterns('blog.apps.homepage.views',
url(r'^$', 'index', name="homepage_index"),
url(r'^about/$', 'about', name="homepage_about"),
url(r'^contact/$', 'contact', name="homepage_contact"),
url(r'^archive/$', 'archive', name="homepage_archive"),
)
全局 urls.py:
(r'^$',include('blog.apps.homepage.urls')),
全局设置.py:
ROOT_URLCONF = 'blog.urls'
树:
templates/
├── base.html
└── homepage
├── about.html
├── archive.html
├── contact.html
└── index.html
索引.html:
{% extends "base.html" %}
{% load url from future %}
{% block title %}
Index Page
{% endblock %}
{% block navi %}
<a href="{% url 'homepage_index' %}">home</a> -
<a href="{% url 'homepage_about' %}">about</a> -
<a href="{% url 'homepage_contact' %}">contact</a> -
<a href="{% url 'homepage_archive' %}">archive</a>
{% endblock %}
{% block content %}
<h3>Entries:</h3>
{%for e in entries %}
<div>{{e.title}} - {{e.created}}</div>
<div>{{e.text}}</div>
<br/>
{% endfor %}
{% endblock %}
{%block footer %}
2012 - MyBlog
{% endblock %}
错误:
未找到带有参数“()”和关键字参数“{}”的“homepage_about”的反向操作。