Forums

Template Loader Postmortem

Template-loader postmortem

Django tried loading these templates, in this order:

Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
    /usr/local/lib/python3.4/dist-packages/django/contrib/admin/templates/home.html (File does not exist)
    /usr/local/lib/python3.4/dist-packages/django/contrib/auth/templates/home.html (File does not exist)

i have tried a lot and a lot!!! but its not workinh!! iam unable to use my templates anywhere else in my views!

May we look at your files? We don't look at them without your permission, but if you say we can look here in the forums then I'll be able to check them out from our side.

yes yes youy can!! please!!!!

I can see you've stored your templates in a folder called mysite/mysite/templates. That's non-standard. By default, django looks for templates folders inside app directories.

If you want to use mysite/mysite/templates, you need to add it explicitly as a location in settings.py:

TEMPLATE_DIRS = ('/home/rakesh13/mysite/mysite/templates',)

I recommend having a read of the django docs on templates

then.. could ypou plss mention .... where is the defualt dir to store templates?? so that i can use it directly the fille name in my code???

If you add the TEMPLATE_DIRS into your settings.py like I said, it'll work fine. If you really want to understand how templates work, you should check out the official django tutorial -- it only takes a couple of hours, and it gives you a good overview of how everything works....