我剛剛開始與Django/Web開發,我遇到了問題。在我的模板文件夾中,我有base.html,home.html和licences.html模板。在home.html的我有一個鏈接<li><a href="{% url 'licences' %}">Licences</a></li>
,在我的views.py我有方法許可證(要求):Django鏈接不顯示新模板
def licences(request):
return render(request, "licences.html", {})
但是如果我然後運行該服務器並點擊鏈接,我得到了一個空白頁只顯示base.html元素。
如何解決這個問題以顯示新的頁面?
編輯:
urls.py
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', 'searchFilm.views.home', name='home'),
url(r'^results/$', 'searchFilm.views.results', name='results'),
url(r'^licences/$', 'searchFilm.views.licences', name='licences')
]
licences.html
<html>
<head>
<!-- <title>{% block title %}HomePage{% endblock %}</title> -->
</head>
<body>
<p>This page contians informations on the licences</p>
</body>
</html>
你的'urls.py'文件是什麼樣的? – HEATH3N
嗨,我已經更新了我的問題 – user2320239
'licences.html'模板是什麼樣的? – Alasdair