Fiz todos os passos da aula mas quando fui visualizar o localhost apareceu isso:
TemplateDoesNotExist at /
index.html
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 3.1.1
Exception Type: TemplateDoesNotExist
Exception Value:
index.html
Exception Location: C:\Users\Windows10\OneDrive\Documents\Python\tdd_com_python\venv\lib\site-packages\django\template\loader.py, line 19, in get_template
Python Executable: C:\Users\Windows10\OneDrive\Documents\Python\tdd_com_python\venv\Scripts\python.exe
Python Version: 3.7.7
Python Path:
['C:\\aplicacao\\venv',
'C:\\Users\\Windows10\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
'C:\\Users\\Windows10\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
'C:\\Users\\Windows10\\AppData\\Local\\Programs\\Python\\Python37\\lib',
'C:\\Users\\Windows10\\AppData\\Local\\Programs\\Python\\Python37',
'C:\\Users\\Windows10\\OneDrive\\Documents\\Python\\tdd_com_python\\venv',
'C:\\Users\\Windows10\\OneDrive\\Documents\\Python\\tdd_com_python\\venv\\lib\\site-packages']
Server time: Thu, 03 Sep 2020 10:21:21 -0300
Os arquivo estão assim:
#index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Alura Receitas</title>
</head>
<body>
<h1>Alura receitas</h1>
<h2>Boas vindas ao site</h2>
<table>
<thead>
<tr>
<td>Nome da receita</td>
<td>Ingredientes</td>
<td>Modo de preparo</td>
</tr>
</thead>
<tbody>
<tr>
<td>Suco verde</td>
<td>Folhas verdes, 1 maça, 1 cenoura</td>
<td>Bata tudo no liquidificador</td>
</tr>
</tbody>
</table>
</body>
</html>
#views.py
from django.shortcuts import render
def index(request):
return render(request, 'index.html')
#urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]