我必须在我的 django 驱动的网站上进行页面。index.html
和books.html
我有这个链接到books.html
我的第一页
<a href="books.html">books</a>
这个是books.html
为了回到第一页。
<a href="index.html">Home</a>
我的 url conf 是这样的
urlpatterns = patterns('',
url(r'^$', 'mysite.views.home', name='home'),
url(r'^books.html/$', 'mysite.views.bookpage', name='books'),
url(r'index.html/$', 'mysite.views.home', name='home'),
)
和views.py
def home(request):
return render_to_response('index.html')
def bookpage(request):
return render_to_response('books.html')
当我点击第二个链接回家时。我的 url 地址看起来像这样
mysite.com/books.html/index.html/
mysite.com/
单击中的第二个链接时,如何将 url 更改回books.html
?
抱歉,如果标题不合适。我不知道我的问题标题是什么
更新
我url(r'^index.html/$', 'mysite.views.home', name='home')
已从我的 url 模式中删除并<a href="{% url 'home' %}">
在第二页中使用。但是当我点击那个链接时什么也没有发生