Q&A

책을 따라하다가 막히는 부분이 있나요?
질문을 남겨주세요.

블로그 작성버튼을 누르면 다음과 같은 오류 발생(해결책을 알려주세요) -crispy 버젼도 바꾸고 여러방법을 동원해도 해결이 안됩니다. ㅠㅠㅠ

11 months, 2 weeks ago

hsollc hsollc

TemplateDoesNotExist at /blog/create_post/

bootstrap4/uni_form.html
Request Method:GET
Request URL:http://127.0.0.1:8000/blog/create_post/
Django Version:4.2.7
Exception Type:TemplateDoesNotExist
Exception Value:
bootstrap4/uni_form.html
Exception Location:D:\test\jcgblog\venv\Lib\site-packages\django\template\backends\django.py, line 84, in reraise
Raised during:blog.views.PostCreate
Python Executable:D:\test\jcgblog\venv\Scripts\python.exe
Python Version:3.11.5
Python Path:
['D:\\test\\jcgblog',
 'C:\\Users\\hsoll\\Anaconda3\\python311.zip',
 'C:\\Users\\hsoll\\Anaconda3\\DLLs',
 'C:\\Users\\hsoll\\Anaconda3\\Lib',
 'C:\\Users\\hsoll\\Anaconda3',
 'D:\\test\\jcgblog\\venv',
 'D:\\test\\jcgblog\\venv\\Lib\\site-packages']
Server time:Sun, 10 Dec 2023 13:21:18 +0900

Template-loader postmortem

Django tried loading these templates, in this order:

Using engine django:

  • django.template.loaders.app_directories.Loader: D:\test\jcgblog\venv\Lib\site-packages\django\contrib\admin\templates\bootstrap4\uni_form.html (Source does not exist)
  • django.template.loaders.app_directories.Loader: D:\test\jcgblog\venv\Lib\site-packages\django\contrib\auth\templates\bootstrap4\uni_form.html (Source does not exist)
  • django.template.loaders.app_directories.Loader: D:\test\jcgblog\venv\Lib\site-packages\django_extensions\templates\bootstrap4\uni_form.html (Source does not exist)
  • django.template.loaders.app_directories.Loader: D:\test\jcgblog\venv\Lib\site-packages\markdownx\templates\bootstrap4\uni_form.html (Source does not exist)
  • django.template.loaders.app_directories.Loader: D:\test\jcgblog\venv\Lib\site-packages\allauth\templates\bootstrap4\uni_form.html (Source does not exist)
  • django.template.loaders.app_directories.Loader: D:\test\jcgblog\blog\templates\bootstrap4\uni_form.html (Source does not exist)
  • django.template.loaders.app_directories.Loader: D:\test\jcgblog\single_pages\templates\bootstrap4\uni_form.html (Source does not exist)

Error during template rendering

In template D:\test\jcgblog\blog\templates\blog\post_form.html, error at line 9

bootstrap4/uni_form.html

1{% extends 'blog/base_full_width.html' %}
2{% load crispy_forms_tags %}
3{% block head_title %}Create Post - Blog{% endblock %}
4
5{% block main_area %}
6 <h1>Create New Post</h1>
7 <hr/>
8 <form method="post" enctype="multipart/form-data">{% csrf_token %}
9 {{ form | crispy }}
10 <div id="div_id_tags_str">
11 <label for="id_tags_str">Tags:</label>
12 <input type="text" name="tags_str" id="id_tags_str" class="textinput textInput form-control">
13 </div>
14 <br/>
15
16 <button type="submit" class="btn btn-primary float-right">Submit</button>
17 </form>
18 {{ form.media }}
19{% endblock %}

Traceback Switch to copy-and-paste view

  • D:\test\jcgblog\venv\Lib\site-packages\django\template\backends\django.py, line 61, in render
    1.             return self.template.render(context)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 175, in render
    1.                     return self._render(context)
                                      ^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 167, in _render
    1.         return self.nodelist.render(context)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 1005, in render
    1.         return SafeString("".join([node.render_annotated(context) for node in self]))
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 1005, in <listcomp>
    1.         return SafeString("".join([node.render_annotated(context) for node in self]))
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 966, in render_annotated
    1.             return self.render(context)
                              ^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\loader_tags.py, line 157, in render
    1.             return compiled_parent._render(context)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 167, in _render
    1.         return self.nodelist.render(context)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 1005, in render
    1.         return SafeString("".join([node.render_annotated(context) for node in self]))
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 1005, in <listcomp>
    1.         return SafeString("".join([node.render_annotated(context) for node in self]))
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 966, in render_annotated
    1.             return self.render(context)
                              ^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\loader_tags.py, line 63, in render
    1.                 result = block.nodelist.render(context)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 1005, in render
    1.         return SafeString("".join([node.render_annotated(context) for node in self]))
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 1005, in <listcomp>
    1.         return SafeString("".join([node.render_annotated(context) for node in self]))
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 966, in render_annotated
    1.             return self.render(context)
                              ^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 1064, in render
    1.             output = self.filter_expression.resolve(context)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\base.py, line 742, in resolve
    1.                 new_obj = func(obj, *arg_vals)
                                     ^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\crispy_forms\templatetags\crispy_forms_filters.py, line 58, in as_crispy_form
    1.         template = uni_form_template(template_pack)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\crispy_forms\templatetags\crispy_forms_filters.py, line 21, in uni_form_template
    1.     return get_template("%s/uni_form.html" % template_pack)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\loader.py, line 19, in get_template
    1.     raise TemplateDoesNotExist(template_name, chain=chain)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • The above exception (bootstrap4/uni_form.html) was the direct cause of the following exception:

  • D:\test\jcgblog\venv\Lib\site-packages\django\core\handlers\exception.py, line 55, in inner
    1.                 response = get_response(request)
                                     ^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\core\handlers\base.py, line 220, in _get_response
    1.                 response = response.render()
                                      ^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\response.py, line 114, in render
    1.             self.content = self.rendered_content
                                      ^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\response.py, line 92, in rendered_content
    1.         return template.render(context, self._request)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\backends\django.py, line 63, in render
    1.             reraise(exc, self.backend)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
    Local vars
  • D:\test\jcgblog\venv\Lib\site-packages\django\template\backends\django.py, line 84, in reraise
    1.     raise new from exc
              ^^^^^^^^^^^^^^^^^^

sungyong
sungyong   11 months, 1 week ago

settings.py에서 INSTALLED_APPS에 crispy_bootstrap4를 추가했는지 확인해보시겠어요? 

Updated: Dec. 13, 2023, 11:49 p.m.

Leave a Comment:
목록보기
Search
  • 자유게시판
  • Q&A