Forums

Template does not exist

http://www.kokenmetpython.nl Loading the above link I get the message template does not exist. When I look for the file in the console in my virtual environment, I do find the file in the place as told in my settings.py What is going wrong? I also checked for use of capitals in 'templates', but it is spelled correctly. Other topics on the forum on this subject considered but don't apply.

What is the path to your template? Check the error message where django tried to find the template.

For example, is your template actually at /home/codeComm/eindscriptie/scriptie/templates/login.html ?

You may need to set it in django settings.py, and be sure to use os.path.abspath

the path to my template is /home/codeComm/eindscriptie/myenv/scriptie/templates/scriptie/login.html I changed this in settings, but this doesn't help

os.path.abspath is used

Still have no idea what to do to get it running

From the error message that Django provided, it's looking in the following directories:

/home/codeComm/scriptie/templates/scriptie
/home/codeComm/eindscriptie/myenv/local/lib/python2.7/site-packages/django/contrib/admin/templates
/home/codeComm/eindscriptie/myenv/local/lib/python2.7/site-packages/django/contrib/auth/templates
/home/codeComm/eindscriptie/scriptie/templates

ls each of those and make sure that login.html is in one of them.

Thanks, that did the trick!

What does "ls"mean?

@Bebos ls is a command in console that lists all the files.

In general, if you're having problems with django templates, the things to check are:

  • for templates inside your apps, have you added all your apps to INSTALLED_APPS
  • for templates in a folder that's not part of your django apps, have you set TEMPLATES_DIRS in 'settings.py'?
  • for that last, make sure you are using an absolute path.

Thank you, I have already fixed it what i did before was i've used this sign "\" to locate the templates and static files instead of "/", now everything is working fine. Hope ive helped

Great! Glad you worked it out.