TemplateDoesNotExist at /admin

457 просмотра
0
0 Комментариев

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/admin
 
Django Version: 1.6
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'article',
 'loginsys')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Template Loader Error:

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/Users/macpro/djangoenv/bin/firstapp/templates/main.html (File does not exist)
/Users/macpro/djangoenv/bin/firstapp/article/templates/main.html (File does not exist)
/Users/macpro/djangoenv/bin/firstapp/loginsys/templates/main.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
test/myvenv/local/lib/python2.7/site-packages/django/contrib/admin/templates/main.html (File does not exist)
test/myvenv/local/lib/python2.7/site-packages/django/contrib/auth/templates/main.html (File does not exist)
test/myvenv/test/article/templates/main.html (File does not exist)
test/myvenv/test/loginsys/templates/main.html (File does not exist)

Template error:

In template test/myvenv/test/article/templates/articles.html, error at line 1
   main.html
   1 :  {% extends 'main.html' %}
   2 : {% load staticfiles %}
   3 :
   4 : {% block article %}
   5 : <div class="large-8 columns">
   6 : {% for article in articles %}
   7 :     <h6>Дата публикации:{{ article.article_date }}</h6>
   8 :     <h4><a href="/articles/get/{{ article.id }}/">{{ article.article_title }}</a></h4>
   9 :     <p>{{ article.article_text }}</p>
   10 :     <p><a href="/articles/addlike/{{ article.id }}/"><img src="{% static "images.jpg" %}" width="25px" height="25px"></a>{{ article.article_likes }}</p>
   11 :     <hr>

Traceback:

File "django/core/handlers/base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "test/myvenv/test/article/views.py" in articles
  33.     return render_to_response('articles.html', {'articles': current_page.page(page_number), 'username': auth.get_user(request).username})
File "django/shortcuts/__init__.py" in render_to_response
  29.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "django/template/loader.py" in render_to_string
  164.         return t.render(Context(dictionary))
File "django/template/base.py" in render
  140.             return self._render(context)
File "django/template/base.py" in _render
  134.         return self.nodelist.render(context)
File "django/template/base.py" in render
  840.                 bit = self.render_node(node, context)
File "django/template/debug.py" in render_node
  78.             return node.render(context)
File "django/template/loader_tags.py" in render
  101.         compiled_parent = self.get_parent(context)
File "django/template/loader_tags.py" in get_parent
  98.         return get_template(parent)
File "django/template/loader.py" in get_template
  138.     template, origin = find_template(template_name)
File "django/template/loader.py" in find_template
  131.     raise TemplateDoesNotExist(name)
 
Exception Type: TemplateDoesNotExist at /admin
Exception Value: main.html


Добавить комментарий

1 Ответы

Python Опубликовано 12.12.2018
0

Ошибка тут: {% extends 'main.html' %}
Файла main.html не существует, соответсвенно нечего расширять. Скорее всего вы имели в виду base.hml.

P.S. Я слышал неплохо самостоятельно читать сообщения об ошибках, а заодно и документацию.

Добавить комментарий
Напишите свой ответ на данный вопрос.
Scroll Up