Renderizando HTML, render, templates, INSTALLED_APPS e TemplateDoesNotExist
This commit is contained in:
12
aula207_ola_django/blog/templates/blog/exemplo.html
Normal file
12
aula207_ola_django/blog/templates/blog/exemplo.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>EXEMPLO 2</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
12
aula207_ola_django/blog/templates/blog/index.html
Normal file
12
aula207_ola_django/blog/templates/blog/index.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>BLOG 2</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
from django.http import HttpResponse
|
|
||||||
|
|
||||||
# from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
|
||||||
def blog(request):
|
def blog(request):
|
||||||
print('blog')
|
print('blog')
|
||||||
return HttpResponse('blog do app 1')
|
return render(
|
||||||
|
request,
|
||||||
|
'blog/index.html'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def exemplo(request):
|
def exemplo(request):
|
||||||
print('exemplo')
|
print('exemplo')
|
||||||
return HttpResponse('exemplo do app 1')
|
return render(
|
||||||
|
request,
|
||||||
|
'blog/exemplo.html'
|
||||||
|
)
|
||||||
|
|||||||
12
aula207_ola_django/home/templates/home/index.html
Normal file
12
aula207_ola_django/home/templates/home/index.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>HOME 2</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
from django.http import HttpResponse
|
from django.shortcuts import render
|
||||||
|
|
||||||
# from django.shortcuts import render
|
|
||||||
|
|
||||||
|
|
||||||
def home(request):
|
def home(request):
|
||||||
print('home')
|
print('home')
|
||||||
return HttpResponse('home do app 1')
|
|
||||||
|
return render(
|
||||||
|
request,
|
||||||
|
'home/index.html'
|
||||||
|
)
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
'home',
|
||||||
|
'blog',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|||||||
Reference in New Issue
Block a user