[Django] Template View

urls.py

from django.contrib import admin
from django.urls import path
from .views import helloworldfunc, HelloWorldClass

urlpatterns = [
    path('admin/', admin.site.urls),
    path('helloworldurl/', helloworldfunc),
    path('helloworldurl2/', HelloWorldClass.as_view()),
]

views.py

from django.http import HttpResponse
from django.views.generic import TemplateView 

def helloworldfunc(request):
    return HttpResponse("<h1>Hello, World!</h1>")

class HelloWorldClass(TemplateView):
    template_name = "hello.html"

settings.py

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]