Skip to content Skip to sidebar Skip to footer

Templates Not Loading In Django

Problem: template not loading with view .... I've been following a django tutorial, hoping to get some templates working that I created. It looks like this. app/templates └─�

Solution 1:

If your templates folder is in your project root folder and you have profile.html like this: templates/app/profile.html then your view should be something like:

defsome_view(request)
    # some codereturn render(request, 'app/profile.html')

Your profile view could be:

defprofile(request)
    # your codereturn render(request, 'app/profile.html', {'data': userData})

Now, in your template profile.html, you can access the object data

Solution 2:

Need to return render to view e.g. return render(request, 'app/profile.html', {'data': parsedData})

Post a Comment for "Templates Not Loading In Django"