Configurando templates globais com DIRS + extends para herança de templates

This commit is contained in:
Luiz Otávio
2023-04-17 08:09:01 -03:00
parent e3577a686b
commit 476988f861
3 changed files with 18 additions and 13 deletions

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<h1>{% block texto %} BASE {% endblock texto %}</h1>
</body>
</html>

View File

@@ -1,12 +1,3 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>HOME 2</h1>
</body>
</html>
{% extends 'global/base.html' %}
{% block texto %} MUDAR O TEXTO {% endblock texto %}

View File

@@ -56,7 +56,9 @@ ROOT_URLCONF = 'project.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [
BASE_DIR / 'base'
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [