Creating a html template for the view

This commit is contained in:
David Doblas Jiménez 2022-01-02 18:10:23 +01:00
parent 5fd8621793
commit a74b03e094
2 changed files with 3 additions and 5 deletions

View File

@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -56,7 +56,7 @@ ROOT_URLCONF = "portfolio.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"DIRS": [os.path.join(BASE_DIR, "projects/templates")],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [

View File

@ -1,7 +1,5 @@
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def project_list(request):
msg = "<h1>Hello, World!</h1>"
return HttpResponse(msg)
return render(request, "projects/index.html")