0

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:

user1835661
  • 13
  • 2
  • 4

2 Answers2

2

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
Marcs
  • 3,768
  • 5
  • 33
  • 42
Yuji 'Tomita' Tomita
  • 115,817
  • 29
  • 282
  • 245
  • 1
    I checked it is readable and I found out it in exact directory, but still it is give same error – user1835661 Dec 09 '12 at 20:31
  • Can you show output of `ls -l`? Do any other templates load, ever? Admin site, anything. – Yuji 'Tomita' Tomita Dec 09 '12 at 20:58
  • output---> "-rw-r--r-- 1 ulascan ulascan 304 Dec 9 22:37 registration.html" I have admin templates but it is default admin directory it is also work but I am not sure which template work there exist templates/admin directory but default one can work in django files. – user1835661 Dec 09 '12 at 21:29
  • I want to put registration.html template into /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/ but system is not allow this permission denied error, is there a way to put it there and do you think this can solve the problem? – user1835661 Dec 09 '12 at 21:41
  • no - django is clearly trying to load a specific file which exists. Perhaps the app doesn't have permission (running as a different user). Just for kicks, can you try chmod 777 on the registration.html file? – Yuji 'Tomita' Tomita Dec 09 '12 at 22:05
  • I tried but nothing changed :( I think there is a very big mistake in my design ... For example I delete my template directory than admin panel can still work, and when I tried to open registration page program give same error... it did not said there is no templates diroctory, it said I looked template directory and registration.html doesnot exist... – user1835661 Dec 09 '12 at 22:14
0

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.

Sonu kumar
  • 50
  • 5