例外类型:TemplateDoesNotExist

时间:2013-03-21 05:39:10

标签: django

Environment:

Request Method: GET

Django Version: 1.5

Python Version: 2.7.3

Installed Applications:('django.contrib.auth',

 'django.contrib.contenttypes',

 'django.contrib.sessions',

 'django.contrib.sites',

 'django.contrib.messages',

 'django.contrib.staticfiles',

 'allauth',

 'allauth.account',

 'allauth.socialaccount',

 'allauth.socialaccount.providers.facebook',

 'allauth.socialaccount.providers.google',

 'allauth.socialaccount.providers.linkedin',

 'django.contrib.admin')


Template Loader Error:

Django tried loading these templates, in this order:

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

/var/www/testapp/templates/account/login.html (File does not exist)

Using loader django.template.loaders.app_directories.Loader:
/usr/local/lib/python2.7/dist-packages/django/contrib/auth/templates/account/login.html 
(File does not exist)

/var/www/testapp/allauth/templates/account/login.html (File does not exist)

/var/www/testapp/allauth/socialaccount/providers/facebook/templates/account/login.html 
(File does not exist)

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

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  140.                     response = response.render()

File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in render
  105.             self.content = self.rendered_content

File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in rendered_content
  80.         template = self.resolve_template(self.template_name)

File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in resolve_template
  56.             return loader.select_template(template)

File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in select_template
  194.     raise TemplateDoesNotExist(', '.join(not_found))


Exception Type: TemplateDoesNotExist at /accounts/login/
Exception Value: account/login.html

任何人都可以帮助我..

1 个答案:

答案 0 :(得分:0)

在您的文件夹/var/www/testapp/内创建一个名为templates的目录。在此目录中创建另一个名为account的目录,最后创建一个名为login.html的文件。

所以此路径存在:/var/www/testapp/templates/account/login.html

你已经完成了。现在,您可以将{{ form }}或您的请求传递给该模板的任何其他内容。