I'm following this tutorial to learn Django and I've followed part 4 as in the video, but when I reload my page, it's always blank. I've looked at other posts that were also experiencing a blank page, but they don't address my issue and are very old.
Some more info: I'm using Django 4.1.4, all the files are appropriately saved and named like in the video and there are no errors in the terminal
This is my views.py:
from django.shortcuts import render
from django.http import HttpResponse
from .models import ToDoList, Item
# Create your views here.
def index(response, id):
ls = ToDoList.objects.get(id=id)
return render(response, 'main/base.html', {})
def home(response):
return render(response, 'main/home.html', {})
base.html:
<html>
<head>
<title> My Website </title>
</head>
<body>
<p> Base Template</p>
<h1> HELLO </h1>
</body>
</html>
home.html:
{% extends 'main/base.html' %}
I don't know if this issue is caused by a mistake I'm not finding or a version error.
This is a picture of my folders.
urls.py (in "main" folder) must contain:
but urls.py (in "mysite" folder) must contain:
Also base.html and home.html must be in main->templates->main folder Dont forget to add this in mysite->settings
After this make
python manage.py runserver
and open in browser http://127.0.0.1:8000/ But this is a blind parsing, if you wrote what error you have in the terminal, it would be easier to figure out what the specific reason is