itsvinayak/user_login_and_register

TemplateDoesnotExist

Closed this issue · 1 comments

`Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/register/

Django Version: 3.2.18
Python Version: 3.7.9
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'corsheaders',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'user.apps.UserConfig',
'crispy_forms']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Template loader postmortem
Django tried loading these templates, in this order:

Using engine django:
* django.template.loaders.app_directories.Loader: C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\templates\bootstrap4\uni_form.html (Source does not exist)
* django.template.loaders.app_directories.Loader: C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\auth\templates\bootstrap4\uni_form.html (Source does not exist)
* django.template.loaders.app_directories.Loader: D:\Projects\Web\Animzz\Back-end\End\user\templates\bootstrap4\uni_form.html (Source does not exist)

Template error:
In template D:\Projects\Web\Animzz\Back-end\End\user\templates\user\index.html, error at line 11
bootstrap4/uni_form.html
1 : {% load static %}
2 : {% load crispy_forms_tags %}
3 :
4 :
5 :
6 :
7 :
8 :
9 :
10 :
11 :
12 :
13 :
14 : <title>{{title}}</title>
15 :
16 :
17 :
18 :
19 : <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
20 : <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
21 :

Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\backends\django.py", line 61, in render
return self.template.render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 170, in render
return self._render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 162, in _render
return self.nodelist.render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 938, in render
bit = node.render_annotated(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 905, in render_annotated
return self.render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 162, in _render
return self.nodelist.render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 938, in render
bit = node.render_annotated(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 905, in render_annotated
return self.render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 938, in render
bit = node.render_annotated(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 905, in render_annotated
return self.render(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 988, in render
output = self.filter_expression.resolve(context)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\base.py", line 698, in resolve
new_obj = func(obj, *arg_vals)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\crispy_forms\templatetags\crispy_forms_filters.py", line 58, in as_crispy_form
template = uni_form_template(template_pack)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\crispy_forms\templatetags\crispy_forms_filters.py", line 21, in uni_form_template
return get_template("%s/uni_form.html" % template_pack)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\loader.py", line 19, in get_template
raise TemplateDoesNotExist(template_name, chain=chain)

The above exception (bootstrap4/uni_form.html) was the direct cause of the following exception:
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "D:\Projects\Web\Animzz\Back-end\End\user\views.py", line 44, in register
return render(request, 'user/register.html', {'form': form,'title':'reqister here'})
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\loader.py", line 62, in render_to_string
return template.render(context, request)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\backends\django.py", line 63, in render
reraise(exc, self.backend)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\django\template\backends\django.py", line 84, in reraise
raise new from exc

Exception Type: TemplateDoesNotExist at /register/
Exception Value: bootstrap4/uni_form.html
`

please help

https://stackoverflow.com/questions/65238459/templatedoesnotexist-at-users-register-bootstrap5-uni-form-html , following this stack overflow thread should do it. Just install bootstrap5 and set it up in settings.py.