![](/img/trans.png)
[英]Can one define a separate css file for an extending html template in Django?
[英]Django, how to display separate html blocks, which can then be edited in one place
我需要在單獨的塊中顯示導航欄、頁腳、主、基礎、標題,然后可以在一個地方進行編輯,並且更改將發生在所有地方
Сan 你給我一個如何做的想法,我不知道只是
我想用這個 function 來做
{% extends "..{directory}/{the name of html page}.html" %}
但我認為這行不通
Django 支持開箱即用的可重用 HTML 文件
分別創建你的navbar
, footer
和其他附加文件(如果有的話)(通常這種類型的文件存儲在includes
目錄中),然后你可以通過這樣做將它們用於你想要的任何文件......
{% include 'path/to/template.html' %}
如需進一步閱讀,請查看文檔
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.