Ask coding questions

← Back to all posts
Why does main.html not exist
Flyingcrabs (29)

Why does main.html not exist I turned on debug mode to help

Comments
hotnewtop
OldWizard209 (1499)

You have to provide the full path. Not just main.html.

def index(request):
    template = loader.get_template('mainclass/Templates/mainclass/main.html')
    return HttpResponse(template.render())
OldWizard209 (1499)

My bad do this in views.py in the first file:

def index(request):
    template = loader.get_template('Templates/mainclass/main.html')
    return HttpResponse(template.render())

@Flyingcrabs

OldWizard209 (1499)

Because your main.html is empty. add some code in there and you will see the effect. @Flyingcrabs