0
votes

I am trying to load a register template for my first django site, I put register.html file in /home/Desktop/projects/purple/purple/templates/registration.html here but there is a error that is say to there is no file I did not understant that's why? can anyone have a idea?

Request Method: GET

Request URL: http...:127.0.0.1:8000/registration/

Django Version: 1.4

Exception Type: TemplateDoesNotExist

Exception Value: registration.html

Django tried loading these templates, in this order:

Using loader django.template.loaders.filesystem.Loader:Django tried loading these templates, in this order:

  • Using loader django.template.loaders.filesystem.Loader:

    • /home/Desktop/projects/purple/purple/templates/registration.html (File does not exist)
  • Using loader django.template.loaders.app_directories.Loader:

    • /usr/local/lib/python2.7/dist-packages/django/contrib/auth/templates/registration.html (File does not exist)

    • /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/registration.html (File does not exist)

  • Using loader django.template.loaders.eggs.Loader:

2
So is the file in /home/Desktop/projects/purple/purple/templates/ named "register.html" or "registration.html"? - radicalbiscuit
Go to the directory, and see if the file exists. cd /home/Desktop/projects/purple/purple/templates/ - Yuji 'Tomita' Tomita
I can saw with cd in terminal file is exist - user1835661
I can't tell you for sure, since i'm a rookie o Django, but don't you need to insert the templates directory on TEMPLATE_DIRS on settings.py configuration file? - Sammy

2 Answers

2
votes

Given that the exception copy and pasted refers to:

/home/Desktop/projects/purple/purple/templates/registration.html

and can't find it... all of your problems lie in whether or not registration.html exists at the directory.

There are 2 possibilities:

  1. File doesn't exist
    cd into that exact directory and find out if it does.

  2. Permissions
    ls -lh /home/Desktop/projects/purple/purple/templates/registration.html

Make sure it's readable.

chmod 644 /home/Desktop/projects/purple/purple/templates/registration.html
0
votes

do you have Registration directory inside Template directory??

if so then include this is your settings.py .

 TEMPLATE_DIRS = (
      BASE_DIR +'/Templates',
      BASE_DIR +'/registration',

  )

Because django is looking for registration.html in your Template directory instead of /template/registration.

see the order you mentioned in the question. watch the path.