Reputation: 2566
from django.http import HttpResponse
from django.shortcuts import render
def home(request):
return render(request, 'templates/index.html')
But my page says that TemplateDoesNotExist.
What should I do?
Upvotes: 0
Views: 1509
Reputation: 10015
Make a templates\justColor
subdirectory template inside your justColor
folder and move index.html
to there. Then as @Neeraj said you can change render call to render(request, 'justColor/index.html')
.
(Although you should read this part of the django tutorial which will help you more than any trial-and-error in this subject: https://docs.djangoproject.com/en/3.0/intro/tutorial03/)
Upvotes: 0
Reputation: 1
Make sure you have configured urls.py and views.py correctly.
This question is already answered here :Django TemplateDoesNotExist?
Upvotes: 0
Reputation: 783
Create a folder 'justcolor' under templates directory and save index.html in it. change path to 'justcolor/index.html'. return render(request, 'justcolor/index.html')
Upvotes: 1