Configurando templates globais com DIRS + extends para herança de templates
This commit is contained in:
12
aula207_ola_django/base/global/base.html
Normal file
12
aula207_ola_django/base/global/base.html
Normal 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>
|
||||
@@ -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 %}
|
||||
@@ -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': [
|
||||
|
||||
Reference in New Issue
Block a user