1
votes

I have the following directories:

Project

  • templates <-- base.html located here

  • users <-- App

-- users/templates <-- profile.html located here

profile.html extends base.html. And when I'm trying to access it:

return render_to_response('profile.html', {}, context_instance=RequestContext(request))

I'm getting TemplateDoesNotExist exception:

Exception Type: TemplateDoesNotExist Exception Value: profile.html

Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: Using loader django.template.loaders.app_directories.Loader: ...lib/python2.7/site-packages/django/contrib/admin/templates/profile.html (File does not exist) ...lib/python2.7/site-packages/django/contrib/auth/templates/profile.html (File does not exist) ...users/templates/profile.html (File exists)

1

1 Answers

2
votes

Change your templates directory structure, That is app/templates/template.html to app/templates/app/template.html by adding an app directory inside the app/templates directory.

Project
|-- users
|   |-- models.py
|   |-- templates
|       `-- users
|           `-- profile.html
|-- templates
    `-- base.html