How to render template in Django

How to render template in Django

don’t forget to create templates directory in folder root.

│ ├───migrations
│ │ └───__pycache__
│ └───__pycache__
│ └───__pycache__
└───templates Source Code

from django.shortcuts import render
# Create your views here.
def index(request):
    return render(request, "index.html", context) Source Code

from django.contrib import admin
from django.urls import path
from core.views import index
urlpatterns = [
    path('', index),
] Source Code Changes

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR/"templates"],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

Tony BB

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: